protected void SetIconAnimation() { if (myActiveAnimation != EIconActiveAnimation.None) { // do active animation stuff } else { switch (myPassiveAnimation) { case EIconPassiveAnimation.Squeeze: myIcon.SetScale(new Vector2(1.1f, 0.8f)); myIcon.SetPosition(myIcon.GetPosition() + new Vector2(-GetTileSize() * 0.05f, GetTileSize() * 0.2f)); break; case EIconPassiveAnimation.Jump: const float FramesBetweenJumps = 10.0f; float wrappedFrames = FrameCounter.GetCurrentFrame() / FramesBetweenJumps; float jumpProgress = (float)Math.Abs(Math.Sin(wrappedFrames)); const float JumpHeightPercent = 0.05f; //float extraXScale = (1f - jumpProgress) * 0.1f; //myIcon.SetScale(new Vector2(1f + extraXScale, 1f)); myIcon.SetPosition(myIcon.GetPosition() + new Vector2(0.0f, -JumpHeightPercent * GetTileSize() * jumpProgress)); // + new Vector2(-extraXScale / 2f, 0.0f)); break; case EIconPassiveAnimation.None: myIcon.SetScale(new Vector2(1.0f, 1.0f)); break; default: break; } } }