/// <summary> /// Indicates that the effect should start playing. /// </summary> /// <param name="direction">Indicates whether to play the direction in forward direction or reverse direction.</param> public void PlayEffect(EffectDirection direction) { if (_animation != null) { _animation.Stopped -= OnAnimationStopped; if (_animation.IsPlaying) { _animation.Stop(ProceduralAnimationStopState.Complete); } _animation = null; } if ((direction == EffectDirection.Reverse) && (AutoReverse || (Reversible == false))) { direction = EffectDirection.Forward; } if (_reversed) { direction = (direction == EffectDirection.Forward) ? EffectDirection.Reverse : EffectDirection.Forward; } _animation = CreateEffectAnimation(direction); if (_animation != null) { _direction = direction; _animation.Stopped += OnAnimationStopped; OnStarting(); _animation.Play(AssociatedObject); } }
public static ProceduralAnimationController Play(ProceduralAnimation animation, FrameworkElement associatedElement) { ProceduralAnimationController controller = GetAnimationController(associatedElement); controller.PlayCore(animation); return controller; }
/// <internalonly /> protected override bool ProgressCore(bool startRepetition, bool startReverse, DateTime timeStamp) { ProceduralAnimation animation = _animations[_current]; if (_nextAnimation) { if ((_successionDelay.TotalMilliseconds != 0) && ((_successionTimeStamp + _successionDelay) > timeStamp)) { return(false); } _nextAnimation = false; animation.OnPlay(IsReversed); } bool completed = animation.OnProgress(timeStamp); if (completed) { animation.OnStop(/* completed */ true, ProceduralAnimationStopState.Complete); if (IsReversed == false) { _current++; } else { _current--; } _nextAnimation = true; _successionTimeStamp = timeStamp; } return(completed && ((_current == _animations.Length) || (_current == -1))); }
/// <internalonly /> protected override void StopCore(bool completed, ProceduralAnimationStopState stopState) { if (completed == false) { ProceduralAnimation animation = _animations[_current]; animation.OnStop(/* completed */ false, stopState); } }
public static ProceduralAnimationController Play(ProceduralAnimation animation, FrameworkElement associatedElement) { ProceduralAnimationController controller = GetAnimationController(associatedElement); controller.PlayCore(animation); return(controller); }
private void StopCore(ProceduralAnimation animation, ProceduralAnimationStopState stopState) { animation.OnStop(/* completed */ false, stopState); _activeAnimations.Remove(animation); if (_activeAnimations.Count == 0) { _sb.Stop(); } }
private void PlayCore(ProceduralAnimation animation) { if (_activeAnimations == null) { _activeAnimations = new List <ProceduralAnimation>(); } _activeAnimations.Add(animation); animation.OnPlay(/* reversed */ false); _sb.Begin(); }
public static void Stop(ProceduralAnimation animation, ProceduralAnimationStopState stopState) { animation.Controller.StopCore(animation, stopState); }
/// <summary> /// Indicates that the effect should start playing. /// </summary> /// <param name="direction">Indicates whether to play the direction in forward direction or reverse direction.</param> public void PlayEffect(AnimationEffectDirection direction) { if (_animation != null) { _animation.Stopped -= OnAnimationStopped; if (_animation.IsPlaying) { _animation.Stop(ProceduralAnimationStopState.Complete); } _animation = null; } if ((direction == AnimationEffectDirection.Reverse) && (AutoReverse || (Reversible == false))) { direction = AnimationEffectDirection.Forward; } if (_reversed) { direction = (direction == AnimationEffectDirection.Forward) ? AnimationEffectDirection.Reverse : AnimationEffectDirection.Forward; } _animation = CreateEffectAnimation(direction); if (_animation != null) { _direction = direction; _animation.Stopped += OnAnimationStopped; OnStarting(); _animation.Play(AssociatedObject); } }
/// <summary> /// Plays the current layout animation when an arrange pass is completed. /// </summary> protected void EndArrange() { if ((_animations != null) && (_animations.Count != 0)) { _layoutAnimation = new ProceduralAnimationSet(_animations.ToArray()); _layoutAnimation.Play(this); } _animations = null; }
/// <summary> /// Creates a new layout animation when an arrange pass starts. /// </summary> protected void BeginArrange() { if (_layoutAnimation != null) { if (_layoutAnimation.IsPlaying) { _layoutAnimation.Stop(ProceduralAnimationStopState.Abort); } _layoutAnimation = null; } _useAnimation = UseAnimatedLayout; _animations = new List<ProceduralAnimation>(); if (_useAnimation) { if (_useDefaultInterpolation) { _interpolation = EasingInterpolation.Default; } else { _interpolation = Interpolation; if (_interpolation.IsLinearInterpolation) { _interpolation = null; } } _duration = Duration; } }
private void PlayCore(ProceduralAnimation animation) { if (_activeAnimations == null) { _activeAnimations = new List<ProceduralAnimation>(); } _activeAnimations.Add(animation); animation.OnPlay(/* reversed */ false); _sb.Begin(); }