private RuntimeSetterTransition(IAnimator animator, RuntimeTransitionPool pool) { _releaseAction = Release; _animator = animator; _pool = pool; var doubleAnimation = new DoubleAnimation { From = 0.0, To = 1.0 }; Storyboard.SetTarget(doubleAnimation, this); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(ProgressProperty)); _storyboard = new Storyboard { Children = { doubleAnimation } }; _storyboard.Begin(); _storyboard.Stop(); _storyboard.Completed += (sender, args) => OnCompleted(true); }
public static RuntimeSetterTransition RunTransition(RuntimeSetter setter, object from, object to) { var type = from?.GetType() ?? to?.GetType(); if (type == null) { return(null); } var pool = TransitionPools.GetValueOrDefault(type); if (pool == null) { var animatorFactory = AnimatorFactoryProvider.GetAnimatorFactory(type); if (animatorFactory == null) { return(null); } TransitionPools[type] = pool = new RuntimeTransitionPool(animatorFactory); } var runtimeTransition = pool.GeTransition(); runtimeTransition.ValueStore = setter.ActualValueStore; runtimeTransition.Start(setter, from, to); return(runtimeTransition); }