public Tween(TweenMode mode, Ease.Easer easer = null, int duration = 1, bool start = false) { Mode = mode; Easer = easer; Duration = duration; Active = false; if (start) Start(); }
public static Tween Position(Entity entity, Vector2 target, int duration, Ease.Easer easer, TweenMode mode = TweenMode.Single) { Tween tween = new Tween(mode, easer, duration, true); Vector2 start = entity.Position; tween.OnUpdate = (Tween t) => { entity.Position = Vector2.Lerp(start, target, t.Value); }; entity.Add(tween); return tween; }
public static Tween Add(Entity entity, int duration, Ease.Easer easer, Action<Tween> onUpdate, TweenMode mode = TweenMode.Single) { Tween tween = new Tween(mode, easer, duration, true); tween.OnUpdate = onUpdate; entity.Add(tween); return tween; }