public Tweener DOBlendablePunchRotation(int charIndex, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOBlendablePunchRotation(punch, duration, vibrato, elasticity))); }
public Tweener DOLocalMoveZ(int charIndex, float endValue, float duration, bool snapping = false) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.DOLocalMoveZ(endValue, duration, snapping))); }
/// <summary> /// Cleans up tweens that are not active. /// </summary> public void DisposeInactiveTweens() { transformTweensActive = false; if (proxyTransformList != null) { for (var i = proxyTransformList.Count - 1; i >= 0; i--) { ProxyTransform proxy = proxyTransformList[i]; proxy.DisposeFinishedTweens(); if (proxy.Tweens.Count > 0) { transformTweensActive = true; } } } colorTweensActive = false; if (proxyColorList != null) { for (var i = proxyColorList.Count - 1; i >= 0; i--) { ProxyColor proxy = proxyColorList[i]; proxy.DisposeFinishedTweens(); if (proxy.Tweens.Count > 0) { colorTweensActive = true; } } } }
/// <summary>Completes all character tweens on the text mesh</summary> /// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired, /// otherwise they will be ignored</param> public void CompleteAll(bool withCallbacks = false) { if (proxyTransformList != null) { for (var i = 0; i < proxyTransformList.Count; i++) { ProxyTransform proxy = proxyTransformList[i]; for (int j = 0; j < proxy.Tweens.Count; j++) { proxy.Tweens[j].Complete(withCallbacks); } proxy.Tweens.Clear(); } } if (proxyColorList != null) { for (var i = 0; i < proxyColorList.Count; i++) { ProxyColor proxy = proxyColorList[i]; for (int j = 0; j < proxy.Tweens.Count; j++) { proxy.Tweens[j].Complete(withCallbacks); } proxy.Tweens.Clear(); } } }
public Tweener DOBlendableScaleBy(int charIndex, Vector3 byValue, float duration) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOBlendableScaleBy(byValue, duration))); }
public Tweener DOBlendableLocalMoveBy(int charIndex, Vector3 byValue, float duration, bool snapping = false) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOBlendableLocalMoveBy(byValue, duration, snapping))); }
public Tweener DOLocalRotate(int charIndex, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOLocalRotate(endValue, duration, mode))); }
public Sequence DOJump(int charIndex, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOJump(endValue, jumpPower, numJumps, duration, snapping))); }
public Tweener DOScaleZ(int charIndex, float endValue, float duration) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOScaleZ(endValue, duration))); }
public Tweener DOPunchPosition(int charIndex, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1, bool snapping = false) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOPunchPosition(punch, duration, vibrato, elasticity, snapping))); }
public Tweener DOLocalRotateQuaternion(int charIndex, Quaternion endValue, float duration) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOLocalRotateQuaternion(endValue, duration))); }
public Vector3 TransformVector(int charIndex, float x, float y, float z) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.TransformVector(x, y, z) : proxyTransformParent.TransformVector(x, y, z)); }
public Vector3 TransformVector(int charIndex, Vector3 Vector) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.TransformVector(Vector) : proxyTransformParent.TransformVector(Vector)); }
public Vector3 TransformPoint(int charIndex, Vector3 Point) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.TransformPoint(Point) : proxyTransformParent.TransformPoint(Point)); }
public Tweener DOShakeScale(int charIndex, float duration, Vector3 strength, int vibrato = 10, float randomness = 90, bool fadeOut = true) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOShakeScale(duration, strength, vibrato, randomness, fadeOut))); }
public Vector3 InverseTransformDirection(int charIndex, float x, float y, float z) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.InverseTransformDirection(x, y, z) : proxyTransformParent.InverseTransformDirection(x, y, z)); }
public Tweener DOBlendableLocalRotateBy(int charIndex, Vector3 byValue, float duration, RotateMode rotateMode = RotateMode.Fast) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOBlendableLocalRotateBy(byValue, duration, rotateMode))); }
public Tweener DOLookAt(int charIndex, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3?up = null) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOLookAt(towards, duration, axisConstraint, up))); }
public Tweener DOLocalPath(int charIndex, Vector3[] path, float duration, PathType pathType = PathType.Linear, PathMode pathMode = PathMode.Full3D, int resolution = 10, Color?gizmoColor = null) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOLocalPath(path, duration, pathType, pathMode, resolution, gizmoColor))); }
public Tweener DOShakePosition(int charIndex, float duration, float strength = 1, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); return(proxy.AddTween(proxy.Target.DOShakePosition(duration, strength, vibrato, randomness, snapping, fadeOut))); }
public Vector3 TransformDirection(int charIndex, Vector3 direction) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.TransformDirection(direction) : proxyTransformParent.TransformDirection(direction)); }
/// <summary> /// Moves character in a circle around its start position. /// </summary> /// <param name="charIndex">The index of the character to tween</param> /// <param name="radius">The radius of the path for the character to follow</param> /// <param name="duration">The duration of the tween</param> /// <returns></returns> public Tweener DOMoveCircle(int charIndex, float radius, float duration) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); DOMoveCircleHandler handler = new DOMoveCircleHandler(proxy.Target, radius, duration); return(proxy.AddTween(DOTween.To(handler.GetTime, handler.SetTime, duration, duration) .SetEase(Ease.Linear) .SetTarget(proxy.Target))); }
/// <summary> /// <para>Drifts character rotation, like DOShakeRotation but can go more slowly.</para> /// <para>Infinite duration. To stop, call <see cref="DOTween.Kill()"/> on the <see cref="CharTweener"/> or Kill() on the returned tween.</para> /// <para>Creates garbage.</para> /// </summary> /// <param name="charIndex"></param> /// <param name="strength">Max (x, y, z) euler angles.</param> /// <param name="vibrato">Drift speed on (x, y, z) axes</param> /// <param name="fadeInDuration">Time over which the tween ramps up to full strength, in seconds.</param> /// <returns></returns> public Tweener DODriftRotation(int charIndex, Vector3 strength, Vector3 vibrato, float fadeInDuration = 1) { NotifyActiveTransformTween(); ProxyTransform proxy = GetProxyTransform(charIndex); DODriftRotationHandler handler = new DODriftRotationHandler(proxy.Target, strength, vibrato); return(proxy.AddTween(DOTween.To(handler.GetTime, handler.SetTime, DriftTime, DriftTime) .SetEase(Ease.Linear) .SetTarget(proxy.Target))); }
private void UpdateStartPositions() { if (proxyTransformDict == null) { return; } TMP_CharacterInfo[] charInfo = Text.textInfo.characterInfo; int oldLength = lastValue.Length; int newLength = Text.text.Length; foreach (var pair in proxyTransformDict) { int charIndex = pair.Key; ProxyTransform proxy = pair.Value; if (charIndex >= oldLength) { // Character was not present in old text and is present in new text if (charIndex < newLength) { proxy.AssignCharInfo(charInfo[pair.Key]); } } else // pair.Key < oldLength { // Character was present in old text and is not present in new text if (charIndex >= newLength) { proxy.AssignCharIndex(charIndex); } else { proxy.AssignCharInfo(charInfo[pair.Key]); } } } }
private void UpdateCharPositions() { // If no transform tweens have been created then the list of proxies will not exist if (proxyTransformList == null) { return; } for (var i = proxyTransformList.Count - 1; i >= 0; i--) { ProxyTransform proxy = proxyTransformList[i]; if (proxy.CharIndex >= characterCount) { continue; } int charIndex = proxy.CharIndex; TMP_CharacterInfo charInfo = Text.textInfo.characterInfo[charIndex]; if (!charInfo.isVisible || !proxy.Target || !proxy.Target.hasChanged) { continue; } int materialIndex = charInfo.materialReferenceIndex; int vertexIndex = charInfo.vertexIndex; Vector3 origin = (charInfo.topLeft + charInfo.bottomRight) * 0.5f; Vector3[] destinationVertices = Text.textInfo.meshInfo[materialIndex].vertices; Matrix4x4 matrix = Matrix4x4.TRS(proxy.OffsetPosition, proxy.Target.localRotation, proxy.Target.localScale); destinationVertices[vertexIndex + 1] = matrix.MultiplyPoint3x4(charInfo.topLeft - origin) + origin; destinationVertices[vertexIndex + 2] = matrix.MultiplyPoint3x4(charInfo.topRight - origin) + origin; destinationVertices[vertexIndex + 0] = matrix.MultiplyPoint3x4(charInfo.bottomLeft - origin) + origin; destinationVertices[vertexIndex + 3] = matrix.MultiplyPoint3x4(charInfo.bottomRight - origin) + origin; } }
/// <summary> /// Returns the character's current position relative to its original position /// </summary> public Vector3 GetOffsetPosition(int charIndex) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.OffsetPosition : Vector3.zero); }
public Matrix4x4 GetWorldToLocalMatrix(int charIndex) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.worldToLocalMatrix : proxyTransformParent.worldToLocalMatrix); }
public Vector3 GetUpVector(int charIndex) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.up : proxyTransformParent.up); }
public Vector3 GetForwardVector(int charIndex) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.forward : proxyTransformParent.forward); }
public Vector3 GetRightVector(int charIndex) { ProxyTransform proxyTransform = TryGetProxyTransform(charIndex); return(proxyTransform != null ? proxyTransform.Target.right : proxyTransformParent.right); }