Skip to content

Commit

Permalink
Fixed a bug in the offset animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Mar 29, 2019
1 parent 53cd6f5 commit ae20093
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ protected override IAnimationBuilder OnOffset(Axis axis, double? from, double to
AnimationFactories.Add(duration =>
{
// Stop the animation and get the easing function
TargetVisual.StopAnimation(nameof(Visual.Offset));
string property = $"{nameof(Visual.Offset)}.{axis}";
TargetVisual.StopAnimation(property);
CompositionEasingFunction easingFunction = TargetVisual.GetEasingFunction(ease);

// Create and return the animation
ScalarKeyFrameAnimation animation = TargetVisual.Compositor.CreateScalarKeyFrameAnimation((float?)from, (float)to, duration, null, easingFunction);
TargetVisual.StartAnimation(nameof(Visual.Offset), animation);
TargetVisual.StartAnimation(property, animation);
});

return this;
Expand Down

0 comments on commit ae20093

Please sign in to comment.