public static AnimChain.IChain Move(this AnimChain.IChain chain, ItemBox target, Point destination) { double originalX = target.X; double originalY = target.Y; double dx = destination.X - originalX; double dy = destination.Y - originalY; chain.Next(1000, elapsed => { var _elapsed = 1 - (Math.Cos(elapsed * Math.PI) + 1) / 2; target.X = (int)(originalX + dx * _elapsed); target.Y = (int)(originalY + dy * _elapsed); }); return chain; }
public override void Initialize() { base.Initialize(); font = Game.Content.Load<SpriteFont>("PixelFont" + Game.DefaultFontSize); // itembox itembox = new ItemBox(Game); components.Add(itembox); // splash var center = new Vector2(Game.ScreenWidth / 2, Game.ScreenHeight / 2); splash = new Splash( Game, center, Game.ScreenWidth, Color.Black, 0, 0.05, 0.3, 2); components.Add(splash); // box backgroundBox = new Image(Game) { Texture = Game.Content.Load<Texture2D>("white_pixel"), Color = Color.Black, Alpha = 0 }; components.Add(backgroundBox); // text text = new TextLabel(Game) { Text = SpecialName, Color = Color.White, Font = font, Alpha = 0, }; components.Add(text); }