Browse Source

Update bunny.script

Björn Ritzl 5 years ago
parent
commit
5ccbe3ce0b
1 changed files with 5 additions and 14 deletions
  1. 5 14
      examples/animation/basic_tween/bunny.script

+ 5 - 14
examples/animation/basic_tween/bunny.script

@@ -1,18 +1,9 @@
 function init(self)
-    local to = vmath.vector3(400, 400, 0)
-    go.animate(".", "position", go.PLAYBACK_LOOP_PINGPONG, to, go.EASING_INOUTSINE, 2)
+    local to = vmath.vector3(400, 400, 0) -- <1>
+    go.animate(".", "position", go.PLAYBACK_LOOP_PINGPONG, to, go.EASING_INOUTSINE, 2) -- <2>
 end
 
 --[[
-1. In Lua, local variables must be declared prior to their use.
-   Since the functions `up_down()` and `left_right()` refer to 
-   each other we "forward declare" the names `up_down` and 
-   `left_right` before the function definitions.
-2. This function animates the game object position's y component,
-   then calls the function `left_right()` on completion.
-3. This function animates the game object position's x component,
-   then calls the function `up_down()` on completion.
-4. Start by calling the `up_down()` function.
-5. In parallell, tween the scale y component.
-6. And the sprite's tint x component (which is the red value).
---]]
+1. The destination to move the game object to (x, y, z)
+2. This function animates the game object position to the destination and back again repeatedly over a period of 2 seconds. The movement uses a sine-wave easing curve to slow down at the end points.
+--]]