private Tween getTween(TweenBuilder builder) { if (builder.EaseFunction == null) { builder.WithEaseFunction(EaseFunctions.GetEaseFunction(builder.EaseType)); } Tween tween = null; if (cachedTweens.Count > 0) { tween = cachedTweens.Dequeue(); } else { tween = new Tween(); } if (builder.UnscaledTime) { tween.Init(unscaledTime, builder); } else { tween.Init(time, builder); } tweens.AddLast(tween.Node); return(tween); }
public static TweenHandler CreateTween(TweenBuilder builder) { builder.Tweener.Init(builder); Tween tween = I.getTween(builder); tween.Start(); return(tween.GetHandler()); }
public void Init(TweenTime timeProvider, TweenBuilder builder) { this.timeProvider = timeProvider; this.tweener = builder.Tweener; this.easeType = builder.EaseType; this.tweenType = builder.TweenType; this.easeFunction = builder.EaseFunction; this.duration = builder.Duration; this.delayTime = builder.Delay; this.handler = builder.Handler; this.startTime = 0; this.realTime = 0; this.pauseTime = 0; }
/* Value tweens */ public static TweenHandler FloatTo(this Material material, string propertyName, float dest, TweenBuilder builder) { builder.WithTweener(new MaterialFloatTweener(material, propertyName, dest)); return(CoolestTween2.CreateTween(builder)); }
public static TweenHandler MainColorTo(this Material material, Color dest, TweenBuilder builder) { builder.WithTweener(new MaterialColorTweener(material, "_Color", dest)); return(CoolestTween2.CreateTween(builder)); }
/* Transform tweens */ public static TweenHandler MoveTo(this Transform transform, Vector3 dest, TweenBuilder builder) { builder.WithTweener(new TrPositionTweener(transform, dest)); return(CoolestTween2.CreateTween(builder)); }
public static TweenHandler ColorTo(this SpriteRenderer spriteRenderer, Color dest, TweenBuilder builder) { builder.WithTweener(new SpriteColorTweener(spriteRenderer, dest)); return(CoolestTween2.CreateTween(builder)); }
/* Color tweens */ public static TweenHandler ColorTo(this Image image, Color dest, TweenBuilder builder) { builder.WithTweener(new ImageColorTweener(image, dest)); return(CoolestTween2.CreateTween(builder)); }
public static TweenHandler ChangeSizeDelta(this RectTransform transform, Vector2 dest, TweenBuilder builder) { builder.WithTweener(new TrSizeDeltaTweener(transform, dest)); return(CoolestTween2.CreateTween(builder)); }
public static TweenHandler MoveToWaypoints(this Transform transform, Vector3[] path, TweenBuilder builder) { builder.WithTweener(new TrPositionWaypointsTweener(transform, path)); return(CoolestTween2.CreateTween(builder)); }
public Tween(TweenTime timeProvider, TweenBuilder builder) { Init(timeProvider, builder); }