STRd6 / pixieengine.com

Where pixels become heros, together.
https://pixieengine.com
30 stars 11 forks source link

Tweening #176

Closed mdiebolt closed 12 years ago

mdiebolt commented 12 years ago

After seeing Chevy Ray's LD keynote I want to have access to tweening functions for as many parts of our engine as we can.

Use cases

  1. Camera tracking
  2. Object distortions (in the keynote his box stretches when it jumps and squishes when it lands)
  3. Health meter changes
  4. Text effects
STRd6 commented 12 years ago

Proposed API (we should probably copy TweenLite/Max API as much as possible as it is practically an industry standard http://www.greensock.com/tweenmax/).

duration = 15

self.tween duration,
    x: 75

This will tween the x property to 75 over the given duration. We can use special properties to specify easing functions and additional params, much like TweenMax.

A related issue is choosing a more consistent unit of duration than frames. I think we should switch to seconds everywhere possible because it is more intuitive and less tied to frame rate.

STRd6 commented 12 years ago

It's in. We should switch over to seconds (or milliseconds) instead of frames for our default internal units of time. In order to do so we should pass the elapsed time as a parameter in the update method, I hear game engines often do that.

The more I think about it the more that milliseconds seems best for the internal units, because we can pass them directly or as 1.second, 4.seconds, etc.