Permalink
Browse files

Starting cleaning up examples.

  • Loading branch information...
1 parent 4ea53a0 commit 4bbefd66e3cd43cfdf5949a8883f4fcbc2408404 @nonken nonken committed Oct 8, 2012
@@ -1,8 +1,7 @@
-stage.addChild(bonsai.Path.rect(500, 0, 100, 100).attr('fillColor', 'random'));
+stage.addChild(new Rect(500, 0, 100, 100).attr('fillColor', 'random'));
setTimeout(function() {
for (var i = 0; i < 10000; i++) {
var factor = i % 500, add = i / 50 | 0;
-
- stage.addChild(bonsai.Path.rect(10*factor+add,10*factor, 100, 100).attr('fillColor', 'random'));
+ stage.addChild(new Rect(10*factor+add,10*factor, 100, 100).attr('fillColor', 'random'));
}
}, 100);
@@ -15,12 +15,12 @@ for (var i = 0; i < circles; ++i) {
y = centerY + distance * -Math.cos(f*2*Math.PI),
radius = random() * radiusVar + radiusMin;
- circle = bonsai.Path.
- circle(x, y, radius).
-// attr({fillColor: 'hsl(' + (i / circles * 360) + ', 100%, 50%)'});
+ circle = new Circle(x, y, radius).
attr({fillColor: 'random', fillGradient: bonsai.gradient.radial(['#FFFFFF88', '#FFFFFF00'])});
+
circle.x = x;
circle.y = y;
+
stage.addChild(circle);
}
@@ -29,7 +29,6 @@ stage.length(frames);
var spread = 80;
stage.on(0, function() {
for (var i = 0, circle; (circle = c[i++]); ) {
-
circle.animate(frames, {
x: circle.x + spread * random() - spread / 2,
y: circle.y + spread * random() - spread / 2
@@ -1,13 +1,13 @@
/**
* Cloned animations. Note how the cloned animation does not pause along with the original one.
*/
-var shape1 = bonsai.Path.rect(0, 50, 100, 100).attr({fillColor: 'red'});
-var shape2 = bonsai.Path.rect(0, 200, 100, 100).attr({fillColor: 'green'});
-var shape3 = bonsai.Path.rect(0, 350, 100, 100).attr({fillColor: 'blue'});
+var shape1 = new Rect(0, 50, 100, 100).attr({fillColor: 'red'});
+var shape2 = new Rect(0, 200, 100, 100).attr({fillColor: 'green'});
+var shape3 = new Rect(0, 350, 100, 100).attr({fillColor: 'blue'});
stage.children([shape1,shape2,shape3]);
-var fadeOutAnim = new bonsai.Animation('3s', { opacity: 0 });
+var fadeOutAnim = new Animation('3s', { opacity: 0 });
@@ -1,8 +1,13 @@
/**
* Animated Color
*/
-var rect = bonsai.Path.rect(150, 150, 150, 150).attr({fillColor: 'red', strokeColor: 'green'});
+var rect = new Rect(150, 150, 150, 150).attr({
+ fillColor: 'red',
+ strokeColor: 'green'
+}).addTo(stage);
-stage.addChild(rect);
-
-rect.animate('3s', {fillColor: 'blue', strokeColor: 'yellow', strokeWidth: 70});
+rect.animate('3s', {
+ fillColor: 'blue',
+ strokeColor: 'yellow',
+ strokeWidth: 70
+});
@@ -11,4 +11,8 @@ var rectPath = new Rect(0, 0, 150, 150).attr({
stage.addChild(rectPath);
-rectPath.animate('2s', {rotation: Math.PI*2}, {easing: 'elasticInOut'});
+rectPath.animate('2s', {
+ rotation: Math.PI*2
+}, {
+ easing: 'elasticInOut'
+});

0 comments on commit 4bbefd6

Please sign in to comment.