Exemple #1
0
        // --------------------------------------------------------------------------

        Behavior <float> ToSingle()
        {
            return(Behavior.Create(ctx => Convert.ToSingle(this.BehaviorFunc(ctx))));
        }
Exemple #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));
 }
Exemple #3
0
 public static Behavior <IDrawing> Cirle(Behavior <Brush> brush, Behavior <float> size)
 {
     return(Behavior.Lift <Brush, float, IDrawing>(Drawings.Circle)(brush, size));
 }
Exemple #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));
 }
Exemple #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));
 }
Exemple #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))));
 }
Exemple #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))));
 }
Exemple #8
0
 // Extension method for floats only
 public static Behavior <float> Forever(this float v)
 {
     return(Behavior.Create(ctx => v));
 }
Exemple #9
0
 // Create constant behavior from a value
 public static Behavior <T> Forever <T>(T v)
 {
     return(Behavior.Create(ctx => v));
 }