Esempio n. 1
0
        // --------------------------------------------------------------------------

        Behavior <float> ToSingle()
        {
            return(Behavior.Create(ctx => Convert.ToSingle(this.BehaviorFunc(ctx))));
        }
Esempio n. 2
0
 public static Behavior <float> operator +(Behavior <T> a, Behavior <float> b)
 {
     return(Behavior.Lift((float x, float y) => x + y)(a.ToSingle(), b));
 }
Esempio n. 3
0
 public static Behavior <IDrawing> Cirle(Behavior <Brush> brush, Behavior <float> size)
 {
     return(Behavior.Lift <Brush, float, IDrawing>(Drawings.Circle)(brush, size));
 }
Esempio n. 4
0
 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));
 }
Esempio n. 5
0
 // 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));
 }
Esempio n. 6
0
 public static Behavior <T> Wait <T>(this Behavior <T> v, float delay)
 {
     return(Behavior.Create(ctx => v.BehaviorFunc(new BehaviorContext(ctx.Time + delay))));
 }
Esempio n. 7
0
 public static Behavior <T> Faster <T>(this Behavior <T> v, float speed)
 {
     return(Behavior.Create(ctx => v.BehaviorFunc(new BehaviorContext(ctx.Time * speed))));
 }
Esempio n. 8
0
 // Extension method for floats only
 public static Behavior <float> Forever(this float v)
 {
     return(Behavior.Create(ctx => v));
 }
Esempio n. 9
0
 // Create constant behavior from a value
 public static Behavior <T> Forever <T>(T v)
 {
     return(Behavior.Create(ctx => v));
 }