public ScalarKeyFrameAnimation CreateTranslationX(FrameworkElement e) { var v = e.EnableCompositionTranslation().GetVisual(); var cin = CompositionFactory.GetEasingFunction(v.Compositor, PennerType.Exponential, PennerVariation.EaseOut); var ani = v.CreateScalarKeyFrameAnimation("Translation.X") .AddKeyFrame(0f, 0) .AddKeyFrame(1f, _rand.Next(-200, 200), cin) .SetDuration(1); return(ani); }
public ScalarKeyFrameAnimation CreateTranslationY(FrameworkElement e) { var v = e.EnableCompositionTranslation().GetVisual(); var t = _rand.Next(-100, 0); var cin = CompositionFactory.GetEasingFunction(v.Compositor, PennerType.Circle, PennerVariation.EaseIn); var cout = CompositionFactory.GetEasingFunction(v.Compositor, PennerType.Circle, PennerVariation.EaseIn); var ani = v.CreateScalarKeyFrameAnimation("Translation.Y") .AddKeyFrame(0f, 0) .AddKeyFrame(0.33f, t, cin) .AddKeyFrame(1f, _rand.Next(t, 10), cout) .SetDuration(1); return(ani); }