public RotationInterpolator(IRenderRotatable target, float start, float end, EaseTypes easeType, float duration = 0, bool isRepeatable = true) : base(start, end, duration, easeType, isRepeatable) { Debug.Assert(target != null, NullMessage); renderTarget = target; }
public ColorInterpolator(IColorContainer target, Color start, Color end, EaseTypes easeType, float duration = 0, bool isRepeatable = true) : base(start, end, duration, easeType, isRepeatable) { Debug.Assert(target != null, NullMessage); containerTarget = target; }
public PositionInterpolator2D(IPositionable2D target, vec2 start, vec2 end, EaseTypes easeType, float duration = 0, bool isRepeatable = true) : base(start, end, duration, easeType, isRepeatable) { Debug.Assert(target != null, NullMessage); this.target = target; }
public OrientationInterpolator(IOrientable target, quat start, quat end, EaseTypes easeType, float duration = 0, bool isRepeatable = true) : base(start, end, duration, easeType, isRepeatable) { Debug.Assert(target != null, NullMessage); this.target = target; }
protected Smoother(T start, T end, float duration, EaseTypes easeType) { this.duration = duration; this.easeType = easeType; Start = start; End = end; }
private void Update() { if (state == GateStates.Closed || state == GateStates.Open) { return; } elapsed += Time.deltaTime; if (elapsed >= currentDuration) { if (state != GateStates.Holding) { transform.position = new Vector3(targetPosition.x, targetPosition.y, ZValue); } elapsed -= currentDuration; switch (state) { case GateStates.Stutter: state = GateStates.Holding; currentDuration = holdTime; break; case GateStates.Holding: state = GateStates.Opening; basePosition = targetPosition; targetPosition = originalPosition + new Vector2(0, height); currentDuration = openDuration; break; case GateStates.Opening: state = GateStates.Open; return; } } if (state != GateStates.Holding) { float amount = elapsed / currentDuration; EaseTypes easeType = state == GateStates.Stutter ? EaseTypes.CubicOut : EaseTypes.CubicIn; Vector2 p = Vector2.Lerp(basePosition, targetPosition, EaseFunctions.Ease(amount, easeType)); // Adding a small Z value causes gates to render behind the tilemap as they open. transform.position = new Vector3(p.x, p.y, ZValue); } }
protected Interpolator(T start, T end, float duration, EaseTypes easeType, bool isRepeatable) { Debug.Assert(duration >= 0, "Interpolator duration can't be negative on construction."); this.duration = duration; this.easeType = easeType; this.isRepeatable = isRepeatable; Start = start; End = end; IsEnabled = !isRepeatable; }
public static float Compute(float t, EaseTypes easeType) { switch (easeType) { case EaseTypes.QuadraticIn: return(QuadraticIn(t)); case EaseTypes.QuadraticOut: return(QuadraticOut(t)); case EaseTypes.CubicIn: return(CubicIn(t)); case EaseTypes.CubicOut: return(CubicOut(t)); } // This is equivalent to EaseTypes.Linear. return(t); }
public static float Ease(float t, EaseTypes type) { switch (type) { case EaseTypes.QuadraticOut: return(QuadraticOut(t)); case EaseTypes.QuadraticInOut: return(QuadraticInOut(t)); case EaseTypes.CubicIn: return(EaseCubicIn(t)); case EaseTypes.CubicOut: return(EaseCubicOut(t)); } // This is equivalent to EaseTypes.Linear. return(t); }
// Using this view, the camera can pan either 1) between two points (using this function), or 2) along a curved // path (using the overloaded version below). public void Refresh(vec3 p1, vec3 p2, float duration, EaseTypes ease) { if (!timer.IsPaused) { timer.Elapsed = 0; } timer.Duration = duration; timer.Tick = t => { Recompute(vec3.Lerp(p1, p2, Ease.Compute(t, ease)), true); }; timer.IsPaused = false; // When a pan begins, the camera is immediately snapped to the starting transform. Recompute(p1, false); }
public RotationInterpolator(IRotationContainer target, EaseTypes easeType, bool isRepeatable = true) : this(target, 0, 0, easeType, 0, isRepeatable) { }
public OrientationInterpolator(IOrientationContainer target, EaseTypes easeType, bool isRepeatable = true) : this(target, quat.Identity, quat.Identity, easeType, 0, isRepeatable) { }
public PositionInterpolator3D(IRenderPositionable3D target, EaseTypes easeType, bool isRepeatable = true) : this(target, vec3.Zero, vec3.Zero, easeType, 0, isRepeatable) { }
public OrientationSmoother(IOrientable target, quat start, quat end, float duration, EaseTypes easeType) : base(start, end, duration, easeType) { this.target = target; }
public PositionInterpolator3D(IPositionContainer3D target, vec3 start, vec3 end, EaseTypes easeType, float duration = 0, bool isRepeatable = true) : base(start, end, duration, easeType, isRepeatable) { Debug.Assert(target != null, NullMessage); containerTarget = target; }
public PositionInterpolator2D(IPositionContainer2D target, EaseTypes easeType, bool isRepeatable = true) : this(target, vec2.Zero, vec2.Zero, easeType, 0, isRepeatable) { }
public void ScaleGameObject(GameObject objectRotate, Vector3 targetScale, float scaleSpeed, EaseTypes type, Action TweenComplete, Action TweenUpdate) { Debug.Log(type); TweenScale newTween = new TweenScale(objectRotate, targetScale, scaleSpeed, easingCombiner[type], TweenComplete, TweenUpdate); _activeTweens.Add(newTween); }
public ColorSmoother(IColorable target, Color start, Color end, float duration, EaseTypes easeType) : base(start, end, duration, easeType) { this.target = target; }
void Awake() { target = new Vector3(-7.4f , 0 , 0); posOriginal = transform.position; ease = new EaseTypes(); }
public void MoveGameObject(GameObject objectToMove, Vector3 targetPosition, float speed, EaseTypes type, Action TweenComplete, Action TweenUpdate) { Debug.Log(type); TweenPosition newTween = new TweenPosition(objectToMove, targetPosition, speed, easingCombiner[type], TweenComplete, TweenUpdate); _activeTweens.Add(newTween); }
public void RotateGameObject(GameObject objectRotate, Vector3 targetRotation, float rotationSpeed, EaseTypes type, Action TweenComplete, Action TweenUpdate) { Debug.Log(type); TweenRotate newTween = new TweenRotate(objectRotate, targetRotation, rotationSpeed, easingCombiner[type], TweenComplete, TweenUpdate); _activeTweens.Add(newTween); }
public ColorInterpolator(IColorContainer target, EaseTypes easeType, bool isRepeatable = true) : this(target, Color.White, Color.White, easeType, 0, isRepeatable) { }
public ColorInterpolator(IRenderColorable target, EaseTypes easeType, bool isRepeatable = true) : this(target, Color.White, Color.White, easeType, 0, isRepeatable) { }
public PositionSmoother3D(IPositionable3D target, vec3 start, vec3 end, float duration, EaseTypes easeType) : base(start, end, duration, easeType) { this.target = target; }