Skip to content
Browse files

Refactored the Bubbles demo a tad.

  • Loading branch information...
1 parent 020dda5 commit f36238b474e16195d01c01f450957a01b5c24ded @jeremyckahn committed Apr 14, 2012
Showing with 17 additions and 13 deletions.
  1. +17 −13 demo/bubbles.html
View
30 demo/bubbles.html
@@ -68,22 +68,26 @@
return keys[parseInt(Math.random() * keys.length, 10)];
}
+ function generateRandomFrame (actor, time) {
+ actor.keyframe(time += 2250, {
+ 'x': getBubbleX()
+ ,'y': getBubbleY()
+ ,'radius': getSize()
+ }, {
+ 'x': getRandomEasing()
+ ,'y': getRandomEasing()
+ ,'radius': getRandomEasing()
+ }).wait(time += 1000);
+
+ // TODO: The fact that this returns an integer makes no
+ // sense, clean this up.
+ return time;
+ }
+
function generateKeyframes (bubbles) {
var i, j
,time = 0;
- function generateRandomFrame (actor) {
- return actor.keyframe(time += 2250, {
- 'x': getBubbleX()
- ,'y': getBubbleY()
- ,'radius': getSize()
- }, {
- 'x': getRandomEasing()
- ,'y': getRandomEasing()
- ,'radius': getRandomEasing()
- }).wait(time += 1000);
- }
-
for (i = 0; i < 30; i++) {
time = 0;
bubbles[i] = makeBubble();
@@ -101,7 +105,7 @@
});
for (j = 0; j < 3; j++) {
- generateRandomFrame(bubbles[i]);
+ time = generateRandomFrame(bubbles[i], time);
}
bubbles[i]

0 comments on commit f36238b

Please sign in to comment.
Something went wrong with that request. Please try again.