// -------------------------------------------------------------------------- Behavior <float> ToSingle() { return(Behavior.Create(ctx => Convert.ToSingle(this.BehaviorFunc(ctx)))); }
public static Behavior <float> operator +(Behavior <T> a, Behavior <float> b) { return(Behavior.Lift((float x, float y) => x + y)(a.ToSingle(), b)); }
public static Behavior <IDrawing> Cirle(Behavior <Brush> brush, Behavior <float> size) { return(Behavior.Lift <Brush, float, IDrawing>(Drawings.Circle)(brush, size)); }
public static Behavior <IDrawing> Translate(this Behavior <IDrawing> drawing, Behavior <float> x, Behavior <float> y) { return(Behavior.Lift <IDrawing, float, float, IDrawing>(Drawings.Translate)(drawing, x, y)); }
// Lifted version of drawing operations public static Behavior <IDrawing> Compose(this Behavior <IDrawing> anim1, Behavior <IDrawing> anim2) { return(Behavior.Lift <IDrawing, IDrawing, IDrawing>(Drawings.Compose)(anim1, anim2)); }
public static Behavior <T> Wait <T>(this Behavior <T> v, float delay) { return(Behavior.Create(ctx => v.BehaviorFunc(new BehaviorContext(ctx.Time + delay)))); }
public static Behavior <T> Faster <T>(this Behavior <T> v, float speed) { return(Behavior.Create(ctx => v.BehaviorFunc(new BehaviorContext(ctx.Time * speed)))); }
// Extension method for floats only public static Behavior <float> Forever(this float v) { return(Behavior.Create(ctx => v)); }
// Create constant behavior from a value public static Behavior <T> Forever <T>(T v) { return(Behavior.Create(ctx => v)); }