public override void Start() { isStarted = true; if (duration == 0) { sprite.SetOverlay(this.toColor); if (!isInfinite) this.Stop(); return; } this.originalColor = sprite.GetOverlay(); if (isFromNull) this.fromColor = this.originalColor; // velocity = UtilityHelper.CalculateVelocity(this.fromColor, this.toColor, duration); Sign = UtilityHelper.CalculateSign(this.fromColor, this.toColor); currentColor = this.fromColor; if (isAnimatedFromOrigin) { currentColor = this.originalColor; Sign = UtilityHelper.CalculateSign(currentColor, this.fromColor); } else { sprite.SetOverlay(this.currentColor); } CurrentTime = TimeSpan.Zero; Duration = TimeSpan.FromSeconds(duration); totalDistance = UtilityHelper.VectorAbs(Vector4.Subtract(toColor, fromColor)); if (graphFunction == null) graphFunction = new ConstantGraphFunction(duration); }
public override void Start() { isStarted = true; this.originalPosition = new Vector2(sprite.Left, sprite.Top); if (duration == 0) { sprite.SetPosition(this.toPosition); if (!isInfinite) this.Stop(); return; } if (isFromNull) fromPosition = this.originalPosition; Sign = UtilityHelper.CalculateSign(this.fromPosition, this.toPosition); currentPosition = this.fromPosition; if (isAnimatedFromOrigin) { currentPosition = this.originalPosition; Sign = UtilityHelper.CalculateSign(currentPosition, this.fromPosition); } else { sprite.SetPosition(this.currentPosition); } CurrentTime = TimeSpan.Zero; Duration = TimeSpan.FromSeconds(duration); totalDistance = UtilityHelper.VectorAbs(Vector2.Subtract(toPosition, fromPosition)); if (graphFunction ==null) graphFunction = new ConstantGraphFunction(duration); }
public override void Start() { isStarted = true; this.originalPosition = sprite.GetRotation(); if (duration == 0) { sprite.SetRotation(this.toDegree); if (!isInfinite) this.Stop(); return; } if (isFromNull) fromDegree = this.originalPosition; Sign = UtilityHelper.CalculateSign(this.fromDegree, this.toDegree); currentDegree = this.fromDegree; if (isAnimatedFromOrigin) { currentDegree = this.originalPosition; Sign = UtilityHelper.CalculateSign(currentDegree, this.fromDegree); } else { sprite.SetRotation(this.currentDegree); } CurrentTime = TimeSpan.Zero; Duration = TimeSpan.FromSeconds(duration); totalDistance = Math.Abs(toDegree- fromDegree); if (graphFunction == null) graphFunction = new ConstantGraphFunction(duration); }
public override void Start() { isStarted = true; this.originalSize = new Vector2(sprite.Width, sprite.Height); if (isFromNull) fromScale = new Vector2(1, 1); fromSize = UtilityHelper.MultiplyVector(this.originalSize, this.fromScale); fromSize.X = (int)fromSize.X; fromSize.Y = (int)fromSize.Y; toSize = UtilityHelper.MultiplyVector(this.originalSize, this.toScale); toSize.X = (int)toSize.X; toSize.Y = (int)toSize.Y; if (duration == 0) { sprite.SetSize(this.toSize); if (!isInfinite) this.Stop(); return; } velocity = UtilityHelper.CalculateVelocity(this.fromSize, this.toSize, duration); Sign = UtilityHelper.CalculateSign(this.fromSize, this.toSize); currentSize = this.fromSize; if (isAnimatedFromOrigin) { currentSize = this.originalSize; Sign = UtilityHelper.CalculateSign(currentSize, this.fromSize); } else { sprite.SetSize(this.currentSize); } CurrentTime = TimeSpan.Zero; Duration = TimeSpan.FromSeconds(duration); totalDistance = UtilityHelper.VectorAbs(Vector2.Subtract(toSize, fromSize)); if (graphFunction == null) graphFunction = new ConstantGraphFunction(duration); }