public static TweenBuilder <SceneComponent> Rotate(this TweenBuilder <SceneComponent> tweenTarget, Quaternion quaternion) { return(Value( tweenTarget, quaternion, t => t.RelativeRotation, (t, v) => t.RelativeRotation = v)); }
public static TweenBuilder <SceneComponent> Translate(this TweenBuilder <SceneComponent> tweenTarget, Vector3 translation) { return(Value( tweenTarget, translation, t => t.RelativeTranslation, (t, v) => t.RelativeTranslation = new Vector3(v.X, v.Y, v.Z))); }
public static TweenBuilder <SceneComponent> Scale(this TweenBuilder <SceneComponent> tweenTarget, Vector3 scale) { return(Value( tweenTarget, scale, t => t.RelativeScale, (t, v) => t.RelativeScale = v)); }
/// <summary> /// Append a new chain element /// </summary> public TweenBuilder <TTarget> Then() { var newTarget = new TweenBuilder <TTarget>(Targets); newTarget.Root = Root; NextChain = newTarget; newTarget.CurrentTween.Duration = CurrentTween.Duration; newTarget.CurrentTween.ScaleFunc = CurrentTween.ScaleFunc; //newTarget.CurrentTween.Repeat = CurrentTween.Repeat; newTarget.CurrentTween.Order = CurrentTween.Order + 1; return(newTarget); }
private TweenFinishedDelegate StartNextChain(TweenBuilder nextChain) { return(() => { foreach (var tweenTarget in nextChain.TweenTargets) { foreach (var tween in tweenTarget.Tweens) { tween.Start(); } } }); }
public TweenBuilder <TNewTarget> For <TNewTarget>(TNewTarget target) { var newTarget = new TweenBuilder <TNewTarget>(target); newTarget.Root = Root; NextTarget = newTarget; newTarget.CurrentTween.Duration = CurrentTween.Duration; newTarget.CurrentTween.ScaleFunc = CurrentTween.ScaleFunc; //newTarget.CurrentTween.Repeat = CurrentTween.Repeat; newTarget.CurrentTween.Order = CurrentTween.Order + 1; newTarget.ChainLevel = ChainLevel + 1; return(newTarget); }
public static TweenBuilder <TTarget> Value <TTarget, TValue>(TweenBuilder <TTarget> tweenTarget, TValue value, Func <TTarget, TValue> getValue, Action <TTarget, TValue> setValue) { var tween = tweenTarget.NewTween <Tween <TValue> >(); Tuple <TTarget, TValue>[] targets = null; tween.OnStart = () => { targets = tweenTarget.Targets.Select(t => new Tuple <TTarget, TValue>(t, getValue(t))).ToArray(); }; tween.Tick = () => { foreach (var comp in targets) { var v = tween.LerpFunc(comp.Item2, value, tween.ScaledPosition); setValue(comp.Item1, v); } }; return(tweenTarget); }
public static TweenBuilder <SceneComponent> Scale(this TweenBuilder <SceneComponent> tweenTarget, float x, float y, float z) { return(Scale(tweenTarget, new Vector3(x, y, z))); }
public static TweenBuilder <SceneComponent> Scale(this TweenBuilder <SceneComponent> tweenTarget, float scale) { return(Scale(tweenTarget, new Vector3(scale))); }
public static TweenBuilder <SceneComponent> Translate(this TweenBuilder <SceneComponent> tweenTarget, float x, float y) { return(Translate(tweenTarget, new Vector2(x, y))); }