nobuyukinyuu / argyne

Superemitter particle system for Monkey

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interpolators

nobuyukinyuu opened this issue · comments

Add interpolators to argyne. Current range functions return a linear value between the min and max values of the range as a percentage between the two. Interpolators would be written into argyne as an interface which would exist as an object in ParticleValues for various components Design of interpolators and how they will apply to ParticleValues is open for consideration.

Considerations:

  1. Can interfaces specify functions instead of methods? Calling a static function would remove the necessity to create global instances to reduce object count.
  2. Various interpolators may be defined in a separate file, perhaps interpolators.monkey. All tween methods supported by skn3's tweening library could be included by default...
  3. This would allow easier implementation of a full spline-based interpolator in the future...

Example code:

Interface Interpolator
    Method Range:Float(startValue:Float, endValue:Float, percent:Float)
End Interface

Class LinearInterpolator Implements Interpolator
    'Summary: Provides a ranged number between startValue and endValue with a percentage range 0-1.
    Method Range:Float(startValue:Float, endValue:Float, percent:Float)
        Return startValue + (percent * (endValue - startValue))
    End Method  
End Class