public void Animate( string animationName, Bind pctl, IBaseModel model, string propertyName, object endValue, float start, float length) { if (model.GetPropertyByName(propertyName).GetType().Equals(typeof(int))) { KineticPath path = new KineticPath( (int)pctl.Get(), (int)endValue, length); PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl); anim.Start = GetCurrentGameTime() + start; anim.End = GetCurrentGameTime() + length + start; AddAnimation(animationName, anim); } else { throw new NotImplementedException("Only integers can be animated now!!!"); } }
public void Update(Double currentTime) { lastUpdateTime = currentTime; lock (animations) { foreach (KeyValuePair <string, PropertyAnimation> animation in animations) { PropertyAnimation node = animation.Value; node.Update(currentTime); } lock (animationsToAdd) { foreach (KeyValuePair <string, PropertyAnimation> animation in animationsToAdd) { animations[animation.Key] = animation.Value; } animationsToAdd.Clear(); } } lock (toDelete) { foreach (string key in toDelete) { RemoveAnimation(key); OnAnimationEnded(key); } toDelete.Clear(); } }
public void AddAnimation(string name, PropertyAnimation anim) { lock (animationsToAdd) { anim.RegisterListener(this); animationsToAdd[name] = anim; } }
private void RemoveAnimation(string name) { lock (animations) { PropertyAnimation anim = animations[name]; anim.Stop(); anim.UnregisterListener(this); animations.Remove(name); } }
public void AnimateColor( string animationName, Bind pctl, object endValue, float length) { ColorAnimationPath path = new ColorAnimationPath( (Color)pctl.Get(), (Color)endValue, length); PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl); anim.Start = CoreAnimation.Instance.GetCurrentGameTime(); anim.End = CoreAnimation.Instance.GetCurrentGameTime() + length; CoreAnimation.Instance.AddAnimation(animationName, anim); }
public void ToggleProperty( string animationName, Bind pctl, object startValue, object endValue, float start, float length, float period) { BlinkPath path = new BlinkPath(startValue, endValue, period, length); PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl); anim.Start = GetCurrentGameTime() + start; anim.End = GetCurrentGameTime() + length + start; AddAnimation(animationName, anim); }
public void Animate( string animationName, Bind pctl, object startValue, object endValue, float start, float length) { KineticPath path = new KineticPath( (int)startValue, (int)endValue, length); PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl); anim.Start = GetCurrentGameTime() + start; anim.End = GetCurrentGameTime() + length + start; AddAnimation(animationName, anim); }