Exemplo n.º 1
0
 public override void Apply(ref AnimatableProperties props)
 {
     if (Direction == FadeDirection.In)
     {
         props.Opacity = (float)MathUtil.Lerp(0.0f, props.TargetOpacity, Value);
     }
     else
     {
         props.Opacity = (float)MathUtil.Lerp(0.0f, props.TargetOpacity, 1.0f - Value);
     }
 }
Exemplo n.º 2
0
        public override void Apply(ref AnimatableProperties props)
        {
            var bounds = props.TargetBounds;
            var b      = new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height);

            switch (Direction)
            {
            case RevealDirection.FromLeft: {
                b.Width = (int)MathUtil.Lerp(0.0, bounds.Width, Value);
            }
            break;

            case RevealDirection.FromRight: {
                double x = MathUtil.Lerp(bounds.X, bounds.X + bounds.Width, 1.0f - Value);
                double w = MathUtil.Lerp(0.0, bounds.Width, Value);
                b.X     = (int)x;
                b.Width = (int)w;
            }
            break;

            case RevealDirection.FromTop: {
                b.Height = (int)MathUtil.Lerp(0.0, bounds.Height, Value);
            }
            break;

            case RevealDirection.FromBottom: {
                double y = MathUtil.Lerp(bounds.Y, bounds.Y + bounds.Height, 1.0f - Value);
                double h = MathUtil.Lerp(0.0, bounds.Height, Value);
                b.Y      = (int)y;
                b.Height = (int)h;
            }
            break;
            }

            props.Bounds = b;
        }
Exemplo n.º 3
0
 public abstract void Apply(ref AnimatableProperties props);