private void Complete()
        {
            AnimatedValue = _to;

            Update?.Invoke(this, EventArgs.Empty);
            AnimationEnd?.Invoke(this, EventArgs.Empty);
        }
示例#2
0
        private IEnumerator End(float time)
        {
            float timer = 0;

            while (timer < time)
            {
                timer += Time.deltaTime;
                yield return(null);
            }
            AnimationEnd?.Invoke();
        }
示例#3
0
        private void FinalizeAnimation()
        {
            if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
            {
                this.Log().DebugFormat("Finalizing animation for GPU Float value animator on property {0}.", _bindingPath.LastOrDefault().PropertyName);
            }

            if (_valueAnimator.IsRunning)
            {
                _valueAnimator.Cancel();
            }

            AnimationEnd?.Invoke(this, EventArgs.Empty);
            ReleaseCoreAnimation();
        }
示例#4
0
    public void Update()
    {
        float t = (Time.time - _startTime) / DestroyTime;

        if (t <= 1.0f)
        {
            _tr.localScale = Vector2.Lerp(_startScale, DestinationScale, t);
        }
        else
        {
            _tr.localScale = _startScale;
            Destroy(this);
            AnimationEnd?.Invoke();
        }
    }
示例#5
0
        protected void OnFrame(object sender, object e)
        {
            var elapsed = _elapsed.ElapsedMilliseconds;

            if (elapsed < StartDelay)
            {
                // We got an invalid tick ... handle it gracefully

                // Reconfigure the start interval to tick only at the end of the start delay
                ConfigureStartInterval(elapsed);

                CurrentPlayTime = 0;
                _currentValue   = _from;
            }
            else if (elapsed >= StartDelay + Duration)
            {
                IsRunning = false;
                DisableFrameReporting();
                _elapsed.Stop();

                CurrentPlayTime = Duration;
                _currentValue   = _to;

                Update?.Invoke(this, EventArgs.Empty);
                AnimationEnd?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                if (_isDelaying)
                {
                    ConfigureAnimationInterval();
                }

                var frame = elapsed - StartDelay;
                var value = GetUpdatedValue(frame, _from, _to);

                CurrentPlayTime = elapsed;
                _currentValue   = value;

                Update?.Invoke(this, EventArgs.Empty);
            }
        }
示例#6
0
文件: Egg.cs 项目: agasus2/Projects
        public void EggMove(object sender, EventArgs e)
        {
            if (_currentFrame == FallFrameIndex)
            {
                ReadyToCatch?.Invoke(this, new EventArgs());
            }

            if (_currentFrame == EndOfWayIndex)
            {
                TimerStop?.Invoke(this, new EventArgs());
                timer.Stop();
                AnimationEnd?.Invoke(this, new EventArgs());
                return;
            }

            EggsDeactivate();

            EggWay[_currentFrame].Visibility = Visibility.Visible;
            _currentFrame++;
        }
示例#7
0
 public void OnAnimationEnd(Animator animation)
 {
     AnimationEnd?.Invoke(Context, new AnimatorEventArgs(animation));
 }
示例#8
0
        /// <summary>
        ///		Ejecuta una serie de acciones
        /// </summary>
        internal void Execute(TimeLineModel timeLine)
        {
            // Crea el storyboard de las animaciones
            if (sbStoryBoard == null)
            {
                // Crea el storyBoard
                sbStoryBoard = new Storyboard();
                // Asigna el evento de fin de animación
                sbStoryBoard.Completed += (sender, evntArgs) => AnimationEnd?.Invoke(this, EventArgs.Empty);
            }
            // Limpia el storyBoard
            sbStoryBoard.Children.Clear();
            // Asigna las propiedades de duración
            sbStoryBoard.BeginTime = TimeSpan.FromSeconds(timeLine.Parameters.Start);
            sbStoryBoard.Duration  = new Duration(TimeSpan.FromSeconds(timeLine.Parameters.Duration));
            // Recorre las acciones añadiéndolas al storyboard
            foreach (ActionBaseModel action in timeLine.Actions)
            {
                if (action != null)
                {
                    FrameworkElement control = PageView.GetPageControl(action.TargetKey);

                    // Ejecuta la acción
                    if (control != null)                             // && control.RenderTransform is TransformGroup)
                    {
                        if (action is SetVisibilityActionModel)
                        {
                            ExecuteVisibility(control, action as SetVisibilityActionModel);
                        }
                        else if (action is ResizeActionModel)
                        {
                            ExecuteResize(timeLine, control, action as ResizeActionModel);
                        }
                        else if (action is RotateActionModel)
                        {
                            ExecuteRotation(control, action as RotateActionModel);
                        }
                        else if (action is ZoomActionModel)
                        {
                            ExecuteZoom(control, action as ZoomActionModel);
                        }
                        else if (action is TranslateActionModel)
                        {
                            ExecuteTranslate(control, action as TranslateActionModel);
                        }
                        else if (action is PathActionModel)
                        {
                            ExecutePathAnimation(control, action as PathActionModel);
                        }
                        else if (action is SetZIndexModel)
                        {
                            ExecuteZIndexAnimation(control, action as SetZIndexModel);
                        }
                        else if (action is BrushViewBoxActionModel)
                        {
                            ExecuteViewBoxAnimation(control, action as BrushViewBoxActionModel);
                        }
                        else if (action is BrushRadialActionModel)
                        {
                            ExecuteBrushRadial(control, action as BrushRadialActionModel);
                        }
                        else if (action is BrushLinearActionModel)
                        {
                            ExecuteBrushLinear(control, action as BrushLinearActionModel);
                        }
                    }
                }
            }
            // Inicia la animación
            if (sbStoryBoard.Children.Count > 0)
            {
                // Lanza el evento de inicio de animación
                AnimationStart?.Invoke(this, EventArgs.Empty);
                // Arranca la animación
                sbStoryBoard.Begin();
            }
        }
示例#9
0
 public void OnAnimationEnd(Animation animation)
 {
     AnimationEnd?.Invoke(animation);
 }
示例#10
0
 protected void OnAnimationEnd()
 {
     AnimationEnd?.Invoke(this, EventArgs.Empty);
 }