Skip to content

Instantly share code, notes, and snippets.

@grisevg
grisevg / BezierEasing.hx
Last active August 29, 2015 14:19
BezierEasing.hx
package;
import haxe.ds.Vector;
/**
* BezierEasing - use 2d bezier curve to describe easing function. Follows specification of CSS3 `cubic-bezier`
* You can easily get desired values in the cubic-bezier editor: http://cubic-bezier.com/
* Implementation article - http://greweb.me/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
* The algorithm uses combination of newton and bisection methods (http://en.wikipedia.org/wiki/Brent%27s_method#Dekker.27s_method)
* to approximate bezier function. Please note that this method is much more slower than direct easing functions.
@grisevg
grisevg / Easings.hx
Created April 21, 2015 20:09
Easings.hx
package;
class Easings
{
//Standard easing functions
public static inline function easeInQuad(t:Float):Float { return t*t }
public static inline function easeOutQuad(t:Float):Float { return t*(2-t) }
public static inline function easeInOutQuad(t:Float):Float { return t<.5 ? 2*t*t : -1+(4-2*t)*t }
public static inline function easeInCubic(t:Float):Float { return t*t*t }
public static inline function easeOutCubic(t:Float):Float { return (--t)*t*t+1 }
@grisevg
grisevg / FlowBlockList.hx
Last active June 15, 2016 23:41
FlowBlockList.hx
package ;
import List;
import tink.core.Noise;
import tink.core.Signal;
import tink.core.SignalTrigger;
using Lambda;
typedef Flow = Void -> Void;