public override void EvaluateAndApply(FloatOptions options, Tween t, bool isRelative, DOGetter <float> getter, DOSetter <float> setter, float elapsed, float startValue, float changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (t.loopType == LoopType.Incremental) { startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); } setter( !options.snapping ? startValue + changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod) : (float)Math.Round(startValue + changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod)) ); }
// usingInversePosition is used by PathPlugin to calculate correctly the current waypoint reached public abstract void EvaluateAndApply(TPlugOptions options, Tween t, bool isRelative, DOGetter <T1> getter, DOSetter <T1> setter, float elapsed, T2 startValue, T2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice);
// ChangeValue is the same as endValue in this plugin public override void EvaluateAndApply(StringOptions options, Tween t, bool isRelative, DOGetter <string> getter, DOSetter <string> setter, float elapsed, string startValue, string changeValue, float duration, bool usingInversePosition) { _Buffer.Remove(0, _Buffer.Length); // Incremental works only with relative tweens (otherwise the tween makes no sense) // Sequence with Incremental loops have no effect here (why should they?) if (isRelative && t.loopType == LoopType.Incremental) { int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; if (iterations > 0) { _Buffer.Append(startValue); for (int i = 0; i < iterations; ++i) { _Buffer.Append(changeValue); } startValue = _Buffer.ToString(); _Buffer.Remove(0, _Buffer.Length); } } int startValueLen = startValue.Length; int changeValueLen = changeValue.Length; int len = (int)Math.Round(changeValueLen * EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod)); if (len > changeValueLen) { len = changeValueLen; } else if (len < 0) { len = 0; } if (isRelative) { _Buffer.Append(startValue); if (options.scramble) { setter(_Buffer.Append(changeValue, 0, len).AppendScrambledChars(changeValueLen - len, options.scrambledChars ?? StringPluginExtensions.ScrambledChars).ToString()); return; } setter(_Buffer.Append(changeValue, 0, len).ToString()); return; } if (options.scramble) { setter(_Buffer.Append(changeValue, 0, len).AppendScrambledChars(changeValueLen - len, options.scrambledChars ?? StringPluginExtensions.ScrambledChars).ToString()); return; } int diff = startValueLen - changeValueLen; int startValueMaxLen = startValueLen; if (diff > 0) { // String to be replaced is longer than endValue: remove parts of it while tweening float perc = (float)len / changeValueLen; startValueMaxLen -= (int)(startValueMaxLen * perc); } else { startValueMaxLen -= len; } _Buffer.Append(changeValue, 0, len); if (len < changeValueLen && len < startValueLen) { _Buffer.Append(startValue, len, startValueMaxLen); } setter(_Buffer.ToString()); }
public static ZTweener Tween(DOGetter <Color> getter, DOSetter <Color> setter, Color to, float duration) { return(new ZTweener(DOTween.To(getter, setter, to, duration))); }
// Calculates the value based on the given time and ease public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter <CustomRange> getter, DOSetter <CustomRange> setter, float elapsed, CustomRange startValue, CustomRange changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); // Here I use startValue directly because CustomRange a struct, so it won't reference the original. // If CustomRange was a class, I should create a new one to pass to the setter startValue.min += changeValue.min * easeVal; startValue.max += changeValue.max * easeVal; setter(startValue); }
public static void animFloatCallbackU(DOGetter<float> getter, DOSetter<float> setter, float duration, float animTo, TweenCallback onUpd) { DOTween.To(getter, setter, animTo, duration).SetUpdate(false).OnUpdate(onUpd); }
public override void EvaluateAndApply(TweenPlugElapsedOptions options, Tween t, bool isRelative, DOGetter <float> getter, DOSetter <float> setter, float elapsed, float startValue, float changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (updateNotice == UpdateNotice.RewindStep) { options.Reset(); } else if (options.Refresh()) { setter(elapsed); } }
private static TweenerCore <Vector3, Vector3[], Vector3ArrayOptions> Shake(DOGetter <Vector3> getter, DOSetter <Vector3> setter, float duration, Vector3 strength, int vibrato, float randomness, bool ignoreZAxis, bool vectorBased, bool fadeOut) { float num = vectorBased ? strength.magnitude : strength.x; int num2 = (int)((float)vibrato * duration); if (num2 < 2) { num2 = 2; } float num3 = num / (float)num2; float[] array = new float[num2]; float num4 = 0f; for (int i = 0; i < num2; i++) { float num5 = (float)(i + 1) / (float)num2; float num6 = fadeOut ? (duration * num5) : (duration / (float)num2); num4 += num6; array[i] = num6; } float num7 = duration / num4; for (int j = 0; j < num2; j++) { array[j] *= num7; } float num8 = Random.Range(0f, 360f); Vector3[] array2 = new Vector3[num2]; for (int k = 0; k < num2; k++) { if (k < num2 - 1) { if (k > 0) { num8 = num8 - 180f + Random.Range(0f - randomness, randomness); } if (vectorBased) { Vector3 vector = Quaternion.AngleAxis(Random.Range(0f - randomness, randomness), Vector3.up) * Utils.Vector3FromAngle(num8, num); vector.x = Vector3.ClampMagnitude(vector, strength.x).x; vector.y = Vector3.ClampMagnitude(vector, strength.y).y; vector.z = Vector3.ClampMagnitude(vector, strength.z).z; array2[k] = vector; if (fadeOut) { num -= num3; } strength = Vector3.ClampMagnitude(strength, num); } else { if (ignoreZAxis) { array2[k] = Utils.Vector3FromAngle(num8, num); } else { Quaternion rotation = Quaternion.AngleAxis(Random.Range(0f - randomness, randomness), Vector3.up); array2[k] = rotation * Utils.Vector3FromAngle(num8, num); } if (fadeOut) { num -= num3; } } } else { array2[k] = Vector3.zero; } } return(DOTween.ToArray(getter, setter, array2, array).NoFrom().SetSpecialStartupMode(SpecialStartupMode.SetShake)); }
public static TweenerCore <Vector3, Vector3[], Vector3ArrayOptions> ToArray(DOGetter <Vector3> getter, DOSetter <Vector3> setter, Vector3[] endValues, float[] durations) { int num = durations.Length; if (num != endValues.Length) { Debugger.LogError("To Vector3 array tween: endValues and durations arrays must have the same length"); return(null); } Vector3[] array = new Vector3[num]; float[] array2 = new float[num]; for (int i = 0; i < num; i++) { array[i] = endValues[i]; array2[i] = durations[i]; } float num2 = 0f; for (int j = 0; j < num; j++) { num2 += array2[j]; } TweenerCore <Vector3, Vector3[], Vector3ArrayOptions> tweenerCore = DOTween.ApplyTo(getter, setter, array, num2, (ABSTweenPlugin <Vector3, Vector3[], Vector3ArrayOptions>)null).NoFrom(); tweenerCore.plugOptions.durations = array2; return(tweenerCore); }
public static TweenerCore <Vector3, Vector3[], Vector3ArrayOptions> Punch(DOGetter <Vector3> getter, DOSetter <Vector3> setter, Vector3 direction, float duration, int vibrato = 10, float elasticity = 1f) { if (elasticity > 1f) { elasticity = 1f; } else if (elasticity < 0f) { elasticity = 0f; } float num = direction.magnitude; int num2 = (int)((float)vibrato * duration); if (num2 < 2) { num2 = 2; } float num3 = num / (float)num2; float[] array = new float[num2]; float num4 = 0f; for (int i = 0; i < num2; i++) { float num5 = (float)(i + 1) / (float)num2; float num6 = duration * num5; num4 += num6; array[i] = num6; } float num7 = duration / num4; for (int j = 0; j < num2; j++) { array[j] *= num7; } Vector3[] array2 = new Vector3[num2]; for (int k = 0; k < num2; k++) { if (k < num2 - 1) { if (k == 0) { array2[k] = direction; } else if (k % 2 != 0) { array2[k] = -Vector3.ClampMagnitude(direction, num * elasticity); } else { array2[k] = Vector3.ClampMagnitude(direction, num); } num -= num3; } else { array2[k] = Vector3.zero; } } return(DOTween.ToArray(getter, setter, array2, array).NoFrom().SetSpecialStartupMode(SpecialStartupMode.SetPunch)); }
public static TweenerCore <Vector3, Vector3[], Vector3ArrayOptions> Shake(DOGetter <Vector3> getter, DOSetter <Vector3> setter, float duration, Vector3 strength, int vibrato = 10, float randomness = 90f, bool fadeOut = true) { return(DOTween.Shake(getter, setter, duration, strength, vibrato, randomness, false, true, fadeOut)); }
public static TweenerCore<Vector3, Vector3, VectorOptions> To( DOGetter<Vector3> getter, DOSetter<Vector3> setter, Vector3 endValue, DOTData data ) { return DOTween.To( getter, setter, endValue, data.duration ).SetEase( data.ease ); }
public static TweenerCore<float, float, FloatOptions> To( DOGetter<float> getter, DOSetter<float> setter, float endValue, DOTData data ) { return DOTween.To( getter, setter, endValue, data.duration ).SetEase( data.ease ); }
public static TweenerCore<Color, Color, ColorOptions> To( DOGetter<Color> getter, DOSetter<Color> setter, Color endValue, DOTData data ) { return DOTween.To( getter, setter, endValue, data.duration ).SetEase( data.ease ); }
// Token: 0x060001CF RID: 463 RVA: 0x0000A500 File Offset: 0x00008700 public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter <uint> getter, DOSetter <uint> setter, float elapsed, uint startValue, uint changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (t.loopType == LoopType.Incremental) { startValue += (uint)((ulong)changeValue * (ulong)((long)(t.isComplete ? (t.completedLoops - 1) : t.completedLoops))); } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { startValue += (uint)((ulong)changeValue * (ulong)((long)((t.loopType == LoopType.Incremental) ? t.loops : 1)) * (ulong)((long)(t.sequenceParent.isComplete ? (t.sequenceParent.completedLoops - 1) : t.sequenceParent.completedLoops))); } setter((uint)Math.Round((double)(startValue + changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod)))); }
internal static TweenerCore <Color2, Color2, ColorOptions> To(DOGetter <Color2> getter, DOSetter <Color2> setter, Color2 endValue, float duration) { return(DOTween.ApplyTo(getter, setter, endValue, duration, (ABSTweenPlugin <Color2, Color2, ColorOptions>)null)); }
public override void EvaluateAndApply(Vector3ArrayOptions options, Tween t, bool isRelative, DOGetter <Vector3> getter, DOSetter <Vector3> setter, float elapsed, Vector3[] startValue, Vector3[] changeValue, float duration, bool usingInversePosition) { Vector3 incrementValue = Vector3.zero; if (t.loopType == LoopType.Incremental) { int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; if (iterations > 0) { int end = startValue.Length - 1; incrementValue = (startValue[end] + changeValue[end] - startValue[0]) * iterations; } } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { int iterations = (t.loopType == LoopType.Incremental ? t.loops : 1) * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); if (iterations > 0) { int end = startValue.Length - 1; incrementValue += (startValue[end] + changeValue[end] - startValue[0]) * iterations; } } // Find correct index and segmentElapsed int index = 0; float segmentElapsed = 0; float segmentDuration = 0; int len = options.durations.Length; float count = 0; for (int i = 0; i < len; i++) { segmentDuration = options.durations[i]; count += segmentDuration; if (elapsed > count) { segmentElapsed += segmentDuration; continue; } index = i; segmentElapsed = elapsed - segmentElapsed; break; } // Evaluate float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, segmentElapsed, segmentDuration, t.easeOvershootOrAmplitude, t.easePeriod); Vector3 res; switch (options.axisConstraint) { case AxisConstraint.X: res = getter(); res.x = startValue[index].x + incrementValue.x + changeValue[index].x * easeVal; if (options.snapping) { res.x = (float)Math.Round(res.x); } setter(res); break; case AxisConstraint.Y: res = getter(); res.y = startValue[index].y + incrementValue.y + changeValue[index].y * easeVal; if (options.snapping) { res.y = (float)Math.Round(res.y); } setter(res); return; case AxisConstraint.Z: res = getter(); res.z = startValue[index].z + incrementValue.z + changeValue[index].z * easeVal; if (options.snapping) { res.z = (float)Math.Round(res.z); } setter(res); break; default: res.x = startValue[index].x + incrementValue.x + changeValue[index].x * easeVal; res.y = startValue[index].y + incrementValue.y + changeValue[index].y * easeVal; res.z = startValue[index].z + incrementValue.z + changeValue[index].z * easeVal; if (options.snapping) { res.x = (float)Math.Round(res.x); res.y = (float)Math.Round(res.y); res.z = (float)Math.Round(res.z); } setter(res); break; } }
private static TweenerCore <T1, T2, TPlugOptions> ApplyTo <T1, T2, TPlugOptions>(DOGetter <T1> getter, DOSetter <T1> setter, T2 endValue, float duration, ABSTweenPlugin <T1, T2, TPlugOptions> plugin = null) where TPlugOptions : struct { DOTween.InitCheck(); TweenerCore <T1, T2, TPlugOptions> tweener = TweenManager.GetTweener <T1, T2, TPlugOptions>(); if (!Tweener.Setup(tweener, getter, setter, endValue, duration, plugin)) { TweenManager.Despawn(tweener, true); return(null); } return(tweener); }
public static void animVec2CallbackU(DOGetter<Vector2> getter, DOSetter<Vector2> setter, float duration, Vector2 animTo, TweenCallback onUpd, Ease easeType = Ease.Linear) { DOTween.To(getter, setter, animTo, duration).SetEase(easeType).SetUpdate(false).OnUpdate(onUpd); }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter <LineComponent> getter, DOSetter <LineComponent> setter, float elapsed, LineComponent startValue, LineComponent changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); LineComponent com = getter(); if (com.Line_Render.positionCount <= com.m_ls_v3.Count) { int nowvalue = (int)(com.m_ls_v3.Count * easeVal); if (nowvalue != com.Line_Render.positionCount) { com.SetV3ToLine(nowvalue); } } //throw new NotImplementedException(); }
public static ZTweener Tween(DOGetter <Vector2> getter, DOSetter <Vector2> setter, Vector2 to, float duration) { return(new ZTweener(DOTween.To(getter, setter, to, duration))); }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter <Vector3> getter, DOSetter <Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (t.loopType == LoopType.Incremental) { startValue += changeValue * (float)(t.isComplete ? (t.completedLoops - 1) : t.completedLoops); } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { startValue += changeValue * (float)((t.loopType != LoopType.Incremental) ? 1 : t.loops) * (float)(t.sequenceParent.isComplete ? (t.sequenceParent.completedLoops - 1) : t.sequenceParent.completedLoops); } float num = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); switch (options.axisConstraint) { case AxisConstraint.X: { Vector3 vector2 = getter(); vector2.x = startValue.x + changeValue.x * num; if (options.snapping) { vector2.x = (float)Math.Round((double)vector2.x); } setter(vector2); break; } case AxisConstraint.Y: { Vector3 vector = getter(); vector.y = startValue.y + changeValue.y * num; if (options.snapping) { vector.y = (float)Math.Round((double)vector.y); } setter(vector); break; } case AxisConstraint.Z: { Vector3 vector3 = getter(); vector3.z = startValue.z + changeValue.z * num; if (options.snapping) { vector3.z = (float)Math.Round((double)vector3.z); } setter(vector3); break; } default: startValue.x += changeValue.x * num; startValue.y += changeValue.y * num; startValue.z += changeValue.z * num; if (options.snapping) { startValue.x = (float)Math.Round((double)startValue.x); startValue.y = (float)Math.Round((double)startValue.y); startValue.z = (float)Math.Round((double)startValue.z); } setter(startValue); break; } }
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter <Color> getter, DOSetter <Color> setter, float elapsed, Color startValue, Color changeValue, float duration) { if (t.loopType == LoopType.Incremental) { startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { startValue += changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); } if (!options.alphaOnly) { startValue.r = EaseManager.Evaluate(t, elapsed, startValue.r, changeValue.r, duration, t.easeOvershootOrAmplitude, t.easePeriod); startValue.g = EaseManager.Evaluate(t, elapsed, startValue.g, changeValue.g, duration, t.easeOvershootOrAmplitude, t.easePeriod); startValue.b = EaseManager.Evaluate(t, elapsed, startValue.b, changeValue.b, duration, t.easeOvershootOrAmplitude, t.easePeriod); startValue.a = EaseManager.Evaluate(t, elapsed, startValue.a, changeValue.a, duration, t.easeOvershootOrAmplitude, t.easePeriod); setter(startValue); return; } // Alpha only Color res = getter(); res.a = EaseManager.Evaluate(t, elapsed, startValue.a, changeValue.a, duration, t.easeOvershootOrAmplitude, t.easePeriod); setter(res); }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter <Vector4Wrapper> getter, DOSetter <Vector4Wrapper> setter, float elapsed, Vector4Wrapper startValue, Vector4Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (t.loopType == LoopType.Incremental) { startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { startValue.value += changeValue.value * (t.loopType == LoopType.Incremental ? t.loops : 1) * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); } float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); switch (options.axisConstraint) { case AxisConstraint.X: Vector4 resX = getter().value; resX.x = startValue.value.x + changeValue.value.x * easeVal; if (options.snapping) { resX.x = (float)Math.Round(resX.x); } setter(resX); break; case AxisConstraint.Y: Vector4 resY = getter().value; resY.y = startValue.value.y + changeValue.value.y * easeVal; if (options.snapping) { resY.y = (float)Math.Round(resY.y); } setter(resY); break; case AxisConstraint.Z: Vector4 resZ = getter().value; resZ.z = startValue.value.z + changeValue.value.z * easeVal; if (options.snapping) { resZ.z = (float)Math.Round(resZ.z); } setter(resZ); break; case AxisConstraint.W: Vector4 resW = getter().value; resW.w = startValue.value.w + changeValue.value.w * easeVal; if (options.snapping) { resW.w = (float)Math.Round(resW.w); } setter(resW); break; default: startValue.value.x += changeValue.value.x * easeVal; startValue.value.y += changeValue.value.y * easeVal; startValue.value.z += changeValue.value.z * easeVal; startValue.value.w += changeValue.value.w * easeVal; if (options.snapping) { startValue.value.x = (float)Math.Round(startValue.value.x); startValue.value.y = (float)Math.Round(startValue.value.y); startValue.value.z = (float)Math.Round(startValue.value.z); startValue.value.w = (float)Math.Round(startValue.value.w); } setter(startValue.value); break; } }
public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter <Vector3> getter, DOSetter <Vector3> setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (t.loopType == LoopType.Incremental && !options.isClosedPath) { int increment = (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (increment > 0) { changeValue = changeValue.CloneIncremental(increment); } } float pathPerc = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); float constantPathPerc = changeValue.ConvertToConstantPathPerc(pathPerc); Vector3 newPos = changeValue.GetPoint(constantPathPerc); changeValue.targetPosition = newPos; // Used to draw editor gizmos setter(newPos); if (options.mode != PathMode.Ignore && options.orientType != OrientType.None) { SetOrientation(options, t, changeValue, constantPathPerc, newPos, updateNotice); } // Determine if current waypoint changed and eventually dispatch callback bool isForward = !usingInversePosition; if (t.isBackwards) { isForward = !isForward; } int newWaypointIndex = changeValue.GetWaypointIndexFromPerc(pathPerc, isForward); if (newWaypointIndex != t.miscInt) { int prevWPIndex = t.miscInt; t.miscInt = newWaypointIndex; if (t.onWaypointChange != null) { // If more than one waypoint changed, dispatch multiple callbacks bool isBackwards = newWaypointIndex < prevWPIndex; if (isBackwards) { for (int i = prevWPIndex - 1; i > newWaypointIndex - 1; --i) { Tween.OnTweenCallback(t.onWaypointChange, i); } } else { for (int i = prevWPIndex + 1; i < newWaypointIndex + 1; ++i) { Tween.OnTweenCallback(t.onWaypointChange, i); } } } } }
public override void EvaluateAndApply(UintOptions options, Tween t, bool isRelative, DOGetter <uint> getter, DOSetter <uint> setter, float elapsed, uint startValue, uint changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { uint v; if (t.loopType == LoopType.Incremental) { v = (uint)(changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops)); if (options.isNegativeChangeValue) { startValue -= v; } else { startValue += v; } } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { v = (uint)(changeValue * (t.loopType == LoopType.Incremental ? t.loops : 1) * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops)); if (options.isNegativeChangeValue) { startValue -= v; } else { startValue += v; } } v = (uint)Math.Round(changeValue * EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod)); if (options.isNegativeChangeValue) { setter(startValue - v); } else { setter(startValue + v); } }
// Token: 0x06000174 RID: 372 RVA: 0x00008114 File Offset: 0x00006314 public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter <Color2> getter, DOSetter <Color2> setter, float elapsed, Color2 startValue, Color2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (t.loopType == LoopType.Incremental) { startValue += changeValue * (float)(t.isComplete ? (t.completedLoops - 1) : t.completedLoops); } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { startValue += changeValue * (float)((t.loopType == LoopType.Incremental) ? t.loops : 1) * (float)(t.sequenceParent.isComplete ? (t.sequenceParent.completedLoops - 1) : t.sequenceParent.completedLoops); } float num = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); if (!options.alphaOnly) { startValue.ca.r = startValue.ca.r + changeValue.ca.r * num; startValue.ca.g = startValue.ca.g + changeValue.ca.g * num; startValue.ca.b = startValue.ca.b + changeValue.ca.b * num; startValue.ca.a = startValue.ca.a + changeValue.ca.a * num; startValue.cb.r = startValue.cb.r + changeValue.cb.r * num; startValue.cb.g = startValue.cb.g + changeValue.cb.g * num; startValue.cb.b = startValue.cb.b + changeValue.cb.b * num; startValue.cb.a = startValue.cb.a + changeValue.cb.a * num; setter(startValue); return; } Color2 pNewValue = getter(); pNewValue.ca.a = startValue.ca.a + changeValue.ca.a * num; pNewValue.cb.a = startValue.cb.a + changeValue.cb.a * num; setter(pNewValue); }
//--------------------------------------------------------------------- public static Tweener DoTweenTo(DOGetter <int> g, DOSetter <int> s, int endValue, float duration) { var t = DOTween.To(g, s, endValue, duration); return(t); }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter <Quaternion> getter, DOSetter <Quaternion> setter, float elapsed, Quaternion startValue, Quaternion changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { float num = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); startValue.x += changeValue.x * num; startValue.y += changeValue.y * num; startValue.z += changeValue.z * num; startValue.w += changeValue.w * num; setter(startValue); }
public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, ulong changeValue) => default; // 0x004D3BE0-0x004D3C00 public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter <ulong> getter, DOSetter <ulong> setter, float elapsed, ulong startValue, ulong changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { } // 0x004D3C00-0x004D3DA0
public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter <Vector3> getter, DOSetter <Vector3> setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { base.EvaluateAndApply(options, t, isRelative, () => getter(), (x) => setter(new Vector3(Mathf.Round(x.x * unitConv) / unitConv, Mathf.Round(x.y * unitConv) / unitConv, Mathf.Round(x.z * unitConv) / unitConv)), elapsed, startValue, changeValue, duration, usingInversePosition, updateNotice); }
public override void EvaluateAndApply(RectOptions options, Tween t, bool isRelative, DOGetter <Rect> getter, DOSetter <Rect> setter, float elapsed, Rect startValue, Rect changeValue, float duration, bool usingInversePosition) { if (t.loopType == LoopType.Incremental) { int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; startValue.x += changeValue.x * iterations; startValue.y += changeValue.y * iterations; startValue.width += changeValue.width * iterations; startValue.height += changeValue.height * iterations; } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { int iterations = (t.loopType == LoopType.Incremental ? t.loops : 1) * (t.sequenceParent.isComplete ? t.sequenceParent.completedLoops - 1 : t.sequenceParent.completedLoops); startValue.x += changeValue.x * iterations; startValue.y += changeValue.y * iterations; startValue.width += changeValue.width * iterations; startValue.height += changeValue.height * iterations; } float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); startValue.x += changeValue.x * easeVal; startValue.y += changeValue.y * easeVal; startValue.width += changeValue.width * easeVal; startValue.height += changeValue.height * easeVal; if (options.snapping) { startValue.x = (float)Math.Round(startValue.x); startValue.y = (float)Math.Round(startValue.y); startValue.width = (float)Math.Round(startValue.width); startValue.height = (float)Math.Round(startValue.height); } setter(startValue); }
public static bool Setup <T1, T2, TPlugOptions>(TweenerCore <T1, T2, TPlugOptions> t, DOGetter <T1> getter, DOSetter <T1> setter, T2 endValue, float duration, ABSTweenPlugin <T1, T2, TPlugOptions> plugin = null) where TPlugOptions : struct { if (plugin != null) { t.tweenPlugin = plugin; } else { if (t.tweenPlugin == null) { t.tweenPlugin = PluginsManager.GetDefaultPlugin <T1, T2, TPlugOptions>(); } if (t.tweenPlugin == null) { Debugger.LogError("No suitable plugin found for this type"); return(false); } } t.getter = getter; t.setter = setter; t.endValue = endValue; t.duration = duration; t.autoKill = DOTween.defaultAutoKill; t.isRecyclable = DOTween.defaultRecyclable; t.easeType = DOTween.defaultEaseType; t.easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; t.easePeriod = DOTween.defaultEasePeriod; t.loopType = DOTween.defaultLoopType; t.isPlaying = (DOTween.defaultAutoPlay == AutoPlay.All || DOTween.defaultAutoPlay == AutoPlay.AutoPlayTweeners); return(true); }
// Token: 0x060001D7 RID: 471 RVA: 0x0000A764 File Offset: 0x00008964 public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter <Vector2> getter, DOSetter <Vector2> setter, float elapsed, Vector2 startValue, Vector2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (t.loopType == LoopType.Incremental) { startValue += changeValue * (float)(t.isComplete ? (t.completedLoops - 1) : t.completedLoops); } if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { startValue += changeValue * (float)((t.loopType == LoopType.Incremental) ? t.loops : 1) * (float)(t.sequenceParent.isComplete ? (t.sequenceParent.completedLoops - 1) : t.sequenceParent.completedLoops); } float num = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); AxisConstraint axisConstraint = options.axisConstraint; if (axisConstraint == AxisConstraint.X) { Vector2 vector = getter(); vector.x = startValue.x + changeValue.x * num; if (options.snapping) { vector.x = (float)Math.Round((double)vector.x); } setter(vector); return; } if (axisConstraint != AxisConstraint.Y) { startValue.x += changeValue.x * num; startValue.y += changeValue.y * num; if (options.snapping) { startValue.x = (float)Math.Round((double)startValue.x); startValue.y = (float)Math.Round((double)startValue.y); } setter(startValue); return; } Vector2 vector2 = getter(); vector2.y = startValue.y + changeValue.y * num; if (options.snapping) { vector2.y = (float)Math.Round((double)vector2.y); } setter(vector2); }
public static void animVec2(DOGetter<Vector2> getter, DOSetter<Vector2> setter, float duration, Vector2 animTo) { DOTween.To(getter, setter, animTo, duration).SetUpdate(false); }
public override void EvaluateAndApply(AMPlugValueSetOptions options, Tween t, bool isRelative, DOGetter <T> getter, DOSetter <T> setter, float elapsed, T startValue, T changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { if (updateNotice == UpdateNotice.RewindStep) { mCounter = -1; } else if (options.Refresh(ref mCounter)) { setter(getter()); } }
public static void animInt(DOGetter<int> getter, DOSetter<int> setter, float duration, int animTo) { DOTween.To(getter, setter, animTo, duration).SetUpdate(false); }
public static void animFloatCallbacks(DOGetter<float> getter, DOSetter<float> setter, float duration, float animTo, TweenCallback onUpd, TweenCallback onComp, Ease easeType = Ease.Linear) { DOTween.To(getter, setter, animTo, duration).SetEase(easeType).SetUpdate(false).OnUpdate(onUpd).OnComplete(onComp); }