johnatm / itween

Automatically exported from code.google.com/p/itween
1 stars 2 forks source link

Accessable easing equations #80

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'd like to be able to access the easing equations directly.
Of course I could just copy & paste the code in my own class, but that's code 
bloat.

Could you put them in a struct? I think making them public static would also be 
more memory efficient: not every iTween instance needs its own easing 
equations, they can all share the same methods.

--

I've modified and included your code but I haven't tested for speed.
Here's a useful example of using equations directly:

public float CalculateDamage(Enemy target) {

    float dist = Vector3.Distance(transform.position, target.transform.position);
    float damage = EasingEquations.easeOutQuart(hitStats.splashDamage, hitStats.minDamage, dist/hitStats.splashRadius);

    return damage;
}

Original issue reported on code.google.com by wttewaall on 16 Jul 2011 at 3:33

Attachments: