public GearBase(GObject owner) { _owner = owner; pageSet = new PageOptionSet(); easeType = Ease.OutQuad; tweenTime = 0.3f; }
public QuaternionMemberCurve(string propName, Ease ease, float dur, Quaternion start, Quaternion end, bool slerp) : base(propName, ease, dur) { _start = start; _end = end; _useSlerp = slerp; }
public void CreateReelSymbols(JSlotGame slot, int reelIndex, int reelHeight) { this.slot = slot; //this.reelIndex = reelIndex; this.reelLength = reelHeight + 2; this.cellHeight = slot.maker.cellHeight; this.cellMoveCount = slot.maker.cellsSpinCount[reelIndex]; this.cellTweenTime = slot.maker.cellTweenTime; //this.firstMoveEase = slot.maker.firstMoveEase; this.lastMoveEase = slot.maker.lastMoveEase; this.speed = slot.maker.reel2Speed; symbols = new List<GameObject>(8); for (int i = 0; i < reelLength; ++i) //CreateSymbolInQueue(i); { int symbolIndex = GetSymbolIndex(); GameObject newOne = CreateSymbol(i, symbolIndex); symbols.Add(newOne); } this.myTransform = this.transform; ResetReelPosition(); }
public TransMemberCurve(string propName, Ease ease, float dur, Trans start, Trans end, bool slerp) : base(propName, ease, dur) { _start = start; _end = end; _useSlerp = slerp; }
public MeshCurve(Mesh[] meshes, Ease ease, float dur) { _meshes = meshes; _ease = ease; _dur = dur; // At least two meshes if (_meshes.Length < 2) { throw new System.ArgumentException("MeshCurve requires at least 2 source meshes.", "meshes"); } // Make sure all meshes are assigned and shaped correctly! int vertexCount = (_meshes[0] != null) ? _meshes[0].vertexCount : 0; for (int i = 0; i < _meshes.Length; i++) { if (_meshes[i] == null) { throw new System.ArgumentNullException("Mesh " + i + " is null.", "meshes"); } if (_meshes[i].vertexCount != vertexCount) { throw new System.ArgumentException("Mesh " + i + " doesn't have the same number of vertices as the first mesh", "meshes"); } } }
public Vector3MemberCurve(string propName, Ease ease, float dur, Vector3 start, Vector3 end) : base(propName, ease, dur) { _start = start; _end = end; _useSlerp = false; }
public StringCurve(string propName, Ease ease, float dur, string start, string end, StringTweenStyle style) : base(propName, ease, dur) { _start = start; _end = end; _style = style; }
public Vector2MemberCurve(string propName, Ease ease, float dur, Vector2 start, Vector2 end, bool slerp) : base(propName, ease, dur) { _start = start; _end = end; _useSlerp = slerp; }
public MemberCurve(string propName, float dur) { _memberName = propName; _ease = EaseMethods.LinearEaseNone; _dur = dur; _delay = 0f; }
public MemberCurve(string propName, Ease ease, float dur) { _memberName = propName; _ease = ease; _dur = dur; _delay = 0f; }
public static Func<float, float, float, float> Get(Ease ease) { switch(ease) { case Ease.Linear: return Linear; case Ease.BackIn: return InBack; case Ease.BackOut: return OutBack; case Ease.BackInOut: return InOutBack; case Ease.CircIn: return InCirc; case Ease.CircOut: return OutCirc; case Ease.CircInOut: return InOutCirc; case Ease.CubicIn: return InCubic; case Ease.CubicOut: return OutCubic; case Ease.CubicInOut: return InOutCubic; default: throw new Exception("Not supported ease type: " + ease); } }
public GearBase(GObject owner) { _owner = owner; easeType = Ease.OutQuad; tweenTime = 0.3f; delay = 0; }
void SetTextureEase(Ease easeType, Texture2D tx, float elapsed, int y) { int x = (int)((txW - 1) * (elapsed / tweenDuration)); if (y > txH - 1 || y < 0) return; // elastic/back eases tx.SetPixel(x, y, Color.white); tx.Apply(); }
// =================================================================================== // PUBLIC METHODS -------------------------------------------------------------------- // Ease popup with filtered eases public static Ease FilteredEasePopup(Ease currEase) { int stringEaseId = currEase == Ease.INTERNAL_Custom ? FilteredEaseTypes.Length - 1 : Array.IndexOf(FilteredEaseTypes, currEase.ToString()); if (stringEaseId == -1) stringEaseId = 0; stringEaseId = EditorGUILayout.Popup("Ease", stringEaseId, FilteredEaseTypes); return stringEaseId == FilteredEaseTypes.Length - 1 ? Ease.INTERNAL_Custom : (Ease)Enum.Parse(typeof(Ease), FilteredEaseTypes[stringEaseId]); }
public static double Interpolate(float x, float x1, float x2, float y1, float y2, Ease ease) { if (ease == null) ease = Linear.EaseNone; var c = y2 - y1; var d = x2 - x1; return ease (x - x1, y1, c, d); }
public Tween(Setter<float> setter, float start, float target, float duration, Ease ease = null, bool yoyo = false, Action onComplete = null) { Setter = setter; _start = start; _target = target; _duration = duration; _ease = ease ?? Linear.EaseNone; _change = target - start; _elapsedTime = 0; OnComplete = onComplete; _yoyo = yoyo; }
/// <summary>Clears and resets this TweenParams instance using default values, /// so it can be reused without instantiating another one</summary> public TweenParams Clear() { id = target = null; updateType = DOTween.defaultUpdateType; isIndependentUpdate = DOTween.defaultTimeScaleIndependent; onStart = onPlay = onRewind = onUpdate = onStepComplete = onComplete = onKill = null; onWaypointChange = null; isRecyclable = DOTween.defaultRecyclable; isSpeedBased = false; autoKill = DOTween.defaultAutoKill; loops = 1; loopType = DOTween.defaultLoopType; delay = 0; isRelative = false; easeType = Ease.Unset; customEase = null; easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; easePeriod = DOTween.defaultEasePeriod; return this; }
public override void Reset() { base.Reset(); gameObject = null; to = new FsmVector3 { UseVariable = false }; toGameObject = new FsmGameObject { UseVariable = false }; duration = new FsmFloat { UseVariable = false }; setSpeedBased = new FsmBool { UseVariable = false, Value = false }; snapping = new FsmBool { UseVariable = false, Value = false }; setRelative = new FsmBool { UseVariable = false, Value = false }; playInReverse = new FsmBool { UseVariable = false, Value = false }; setReverseRelative = new FsmBool { UseVariable = false, Value = false }; startEvent = null; finishEvent = null; finishImmediately = new FsmBool { UseVariable = false, Value = false }; stringAsId = new FsmString { UseVariable = false }; tagAsId = new FsmString { UseVariable = false }; startDelay = new FsmFloat { Value = 0 }; selectedEase = Doozy.PlayMaker.Actions.SelectedEase.EaseType; easeType = Ease.Linear; loops = new FsmInt { Value = 0 }; loopType = DG.Tweening.LoopType.Restart; autoKillOnCompletion = new FsmBool { Value = true }; recyclable = new FsmBool { Value = false }; updateType = UpdateType.Normal; isIndependentUpdate = new FsmBool { Value = false }; debugThis = new FsmBool { Value = false }; }
public static float EasedValue(float from, float to, float lifetimePercentage, Ease easeType, float amplitude, float period) { return(from + (to - from) * EaseManager.Evaluate(easeType, null, lifetimePercentage, 1f, amplitude, period)); }
public static void SetEase(Tweener t, Ease ease) { t.SetEase(ease); }
public RectMemberCurve(string propName, Ease ease, float dur, Rect start, Rect end) : base(propName, ease, dur) { _start = start; _end = end; }
public static T SetEase <T>(T t, Ease ease) where T : Tween { return(t.SetEase <T>(ease)); }
/// <summary> /// 指定したアイテムの位置まで移動します. /// </summary> /// <param name="itemIndex">アイテムのインデックス.</param> /// <param name="duration">移動にかける秒数.</param> /// <param name="easing">移動に使用するイージング.</param> /// <param name="alignment"><see cref="Alignment"/>.</param> /// <param name="onComplete">移動が完了した際に呼び出されるコールバック.</param> public override void ScrollTo(int itemIndex, float duration, Ease easing, Alignment alignment = Alignment.Center, Action onComplete = null) { var rowIndex = itemIndex / Context.GetColumnCount(); base.ScrollTo(rowIndex, duration, easing, alignment, onComplete); }
public AnimationCurve getCurve(Ease easeType) { AnimationCurve _curve = new AnimationCurve(); switch (easeType) { case Ease.Linear: _curve.AddKey(new Keyframe(0f, 0f, 1f, 1f)); _curve.AddKey(new Keyframe(1f, 1f, 1f, 1f)); break; case Ease.InQuad: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(1f, 1f, 2f, 2f)); break; case Ease.OutQuad: _curve.AddKey(new Keyframe(0f, 0f, 2f, 2f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InOutQuad: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, 2f, 2f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InCubic: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(1f, 1f, 3f, 3f)); break; case Ease.OutCubic: _curve.AddKey(new Keyframe(0f, 0f, 3f, 3f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InOutCubic: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, 3f, 3f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InQuart: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.5f, 0.064f, 0.5f, 0.5f)); _curve.AddKey(new Keyframe(1f, 1f, 4f, 4f)); break; case Ease.OutQuart: _curve.AddKey(new Keyframe(0f, 0f, 4f, 4f)); _curve.AddKey(new Keyframe(0.5f, 0.936f, 0.5f, 0.5f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InOutQuart: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.25f, 0.032f, 0.5f, 0.5f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, 4f, 4f)); _curve.AddKey(new Keyframe(0.75f, 0.968f, 0.5f, 0.5f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InQuint: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.2f, 0f, 0.033f, 0.033f)); _curve.AddKey(new Keyframe(0.6f, 0.077f, 0.65f, 0.65f)); _curve.AddKey(new Keyframe(1f, 1f, 5f, 5f)); break; case Ease.OutQuint: _curve.AddKey(new Keyframe(0f, 0f, 5f, 5f)); _curve.AddKey(new Keyframe(0.4f, 0.92f, 0.65f, 0.65f)); _curve.AddKey(new Keyframe(0.8f, 1f, 0.033f, 0.033f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InOutQuint: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.1f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.3f, 0.04f, 0.65f, 0.65f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, 5f, 5f)); _curve.AddKey(new Keyframe(0.7f, 0.96f, 0.65f, 0.65f)); _curve.AddKey(new Keyframe(0.9f, 1f, 0f, 0f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InSine: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.5f, 0.292f, 1.11f, 1.11f)); _curve.AddKey(new Keyframe(1f, 1f, 1.56f, 1.56f)); break; case Ease.OutSine: _curve.AddKey(new Keyframe(0f, 0f, 1.56f, 1.56f)); _curve.AddKey(new Keyframe(0.5f, 0.708f, 1.11f, 1.11f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InOutSine: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.25f, 0.145f, 1.1f, 1.1f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, 1.6f, 1.6f)); _curve.AddKey(new Keyframe(0.75f, 0.853f, 1.1f, 1.1f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InExpo: _curve.AddKey(new Keyframe(0f, 0f, 0.031f, 0.031f)); _curve.AddKey(new Keyframe(0.5f, 0.031f, 0.214f, 0.214f)); _curve.AddKey(new Keyframe(0.8f, 0.249f, 1.682f, 1.682f)); _curve.AddKey(new Keyframe(1f, 1f, 6.8f, 6.8f)); break; case Ease.OutExpo: _curve.AddKey(new Keyframe(0f, 0f, 6.8f, 6.8f)); _curve.AddKey(new Keyframe(0.2f, 0.751f, 1.682f, 1.682f)); _curve.AddKey(new Keyframe(0.5f, 0.969f, 0.214f, 0.214f)); _curve.AddKey(new Keyframe(1f, 1f, 0.031f, 0.031f)); break; case Ease.InOutExpo: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.25f, 0.015f, 0.181f, 0.181f)); _curve.AddKey(new Keyframe(0.4f, 0.125f, 1.58f, 1.58f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, 6.8f, 6.8f)); _curve.AddKey(new Keyframe(0.6f, 0.873f, 1.682f, 1.682f)); _curve.AddKey(new Keyframe(0.75f, 0.982f, 0.21f, 0.21f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InCirc: _curve.AddKey(new Keyframe(0f, 0f, 0.04f, 0.04f)); _curve.AddKey(new Keyframe(0.6f, 0.2f, 0.76f, 0.76f)); _curve.AddKey(new Keyframe(0.9f, 0.562f, 1.92f, 1.92f)); _curve.AddKey(new Keyframe(0.975f, 0.78f, 4.2f, 4.2f)); _curve.AddKey(new Keyframe(1f, 1f, 17.3f, 17.3f)); break; case Ease.OutCirc: _curve.AddKey(new Keyframe(0f, 0f, 17.3f, 17.3f)); _curve.AddKey(new Keyframe(0.025f, 0.22f, 4.2f, 4.2f)); _curve.AddKey(new Keyframe(0.1f, 0.438f, 1.92f, 1.92f)); _curve.AddKey(new Keyframe(0.4f, 0.8f, 0.76f, 0.76f)); _curve.AddKey(new Keyframe(1f, 1f, 0.04f, 0.04f)); break; case Ease.InOutCirc: _curve.AddKey(new Keyframe(0f, 0f, 0f, 0f)); _curve.AddKey(new Keyframe(0.3f, 0.098f, 0.75f, 0.75f)); _curve.AddKey(new Keyframe(0.45f, 0.281f, 1.96f, 1.96f)); _curve.AddKey(new Keyframe(0.4875f, 0.392f, 4.4f, 4.4f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, 8.14f, 8.14f)); _curve.AddKey(new Keyframe(0.5125f, 0.607f, 4.3f, 4.3f)); _curve.AddKey(new Keyframe(0.55f, 0.717f, 1.94f, 1.94f)); _curve.AddKey(new Keyframe(0.7f, 0.899f, 0.74f, 0.74f)); _curve.AddKey(new Keyframe(1f, 1f, 0f, 0f)); break; case Ease.InBounce: _curve.AddKey(new Keyframe(0f, 0f, 0.715f, 0.715f)); _curve.AddKey(new Keyframe(0.091f, 0f, -0.677f, 1.365f)); _curve.AddKey(new Keyframe(0.272f, 0f, -1.453f, 2.716f)); _curve.AddKey(new Keyframe(0.636f, 0f, -2.775f, 5.517f)); _curve.AddKey(new Keyframe(1f, 1f, -0.0023f, -0.0023f)); break; case Ease.OutBounce: _curve.AddKey(new Keyframe(0f, 0f, -0.042f, -0.042f)); _curve.AddKey(new Keyframe(0.364f, 1f, 5.414f, -2.758f)); _curve.AddKey(new Keyframe(0.727f, 1f, 2.773f, -1.295f)); _curve.AddKey(new Keyframe(0.909f, 1f, 1.435f, -0.675f)); _curve.AddKey(new Keyframe(1f, 1f, 0.735f, 0.735f)); break; case Ease.InOutBounce: _curve.AddKey(new Keyframe(0f, 0f, 0.682f, 0.682f)); _curve.AddKey(new Keyframe(0.046f, 0f, -0.732f, 1.316f)); _curve.AddKey(new Keyframe(0.136f, 0f, -1.568f, 2.608f)); _curve.AddKey(new Keyframe(0.317f, 0f, -2.908f, 5.346f)); _curve.AddKey(new Keyframe(0.5f, 0.5f, -0.061f, 0.007f)); _curve.AddKey(new Keyframe(0.682f, 1f, 5.463f, -2.861f)); _curve.AddKey(new Keyframe(0.864f, 1f, 2.633f, -1.258f)); _curve.AddKey(new Keyframe(0.955f, 1f, 1.488f, -0.634f)); _curve.AddKey(new Keyframe(1f, 1f, 0.804f, 0.804f)); break; case Ease.InBack: _curve.AddKey(new Keyframe(0.00f, 0.00f, 0.00f, 0.00f)); _curve.AddKey(new Keyframe(1.00f, 1.00f, 4.71f, 4.71f)); break; case Ease.OutBack: _curve.AddKey(new Keyframe(0.00f, 0.00f, 4.71f, 4.71f)); _curve.AddKey(new Keyframe(1.00f, 1.00f, 0.00f, 0.00f)); break; case Ease.InOutBack: _curve.AddKey(new Keyframe(0.00f, 0.00f, 0.00f, 0.00f)); _curve.AddKey(new Keyframe(0.50f, 0.50f, 5.61f, 5.61f)); _curve.AddKey(new Keyframe(1.00f, 1.00f, 0.00f, 0.00f)); break; case Ease.InElastic: _curve.AddKey(new Keyframe(0.00f, 0.00f, 0.00f, 0.00f)); _curve.AddKey(new Keyframe(0.15f, 0.00f, -0.04f, -0.04f)); _curve.AddKey(new Keyframe(0.30f, -0.005f, 0.04f, 0.04f)); _curve.AddKey(new Keyframe(0.42f, 0.02f, -0.07f, -0.07f)); _curve.AddKey(new Keyframe(0.58f, -0.04f, 0.15f, 0.15f)); _curve.AddKey(new Keyframe(0.72f, 0.13f, 0.20f, 0.20f)); _curve.AddKey(new Keyframe(0.80f, -0.13f, -5.33f, -5.33f)); _curve.AddKey(new Keyframe(0.868f, -0.375f, 0.14f, 0.14f)); _curve.AddKey(new Keyframe(0.92f, -0.05f, 11.32f, 11.32f)); _curve.AddKey(new Keyframe(1.00f, 1.00f, 7.50f, 7.50f)); break; case Ease.OutElastic: _curve.AddKey(new Keyframe(0.000f, 0.00f, 6.56f, 6.56f)); _curve.AddKey(new Keyframe(0.079f, 1.06f, 11.22f, 11.22f)); _curve.AddKey(new Keyframe(0.134f, 1.38f, 0.03f, 0.03f)); _curve.AddKey(new Keyframe(0.204f, 1.10f, -5.24f, -5.24f)); _curve.AddKey(new Keyframe(0.289f, 0.87f, 0.65f, 0.65f)); _curve.AddKey(new Keyframe(0.424f, 1.05f, 0.13f, 0.13f)); _curve.AddKey(new Keyframe(0.589f, 0.98f, 0.12f, 0.12f)); _curve.AddKey(new Keyframe(0.696f, 1.00f, 0.07f, 0.07f)); _curve.AddKey(new Keyframe(0.898f, 1.00f, 0.00f, 0.00f)); _curve.AddKey(new Keyframe(1.000f, 1.00f, 0.00f, 0.00f)); break; case Ease.InOutElastic: _curve.AddKey(new Keyframe(0.000f, 0.00f, 0.00f, 0.00f)); _curve.AddKey(new Keyframe(0.093f, 0.00f, -0.05f, -0.05f)); _curve.AddKey(new Keyframe(0.149f, 0.00f, 0.06f, 0.06f)); _curve.AddKey(new Keyframe(0.210f, 0.01f, -0.04f, -0.04f)); _curve.AddKey(new Keyframe(0.295f, -0.02f, 0.31f, 0.31f)); _curve.AddKey(new Keyframe(0.356f, 0.07f, 0.11f, 0.11f)); _curve.AddKey(new Keyframe(0.400f, -0.06f, -5.12f, -5.12f)); _curve.AddKey(new Keyframe(0.435f, -0.19f, 0.18f, 0.18f)); _curve.AddKey(new Keyframe(0.463f, 0.02f, 12.44f, 12.44f)); _curve.AddKey(new Keyframe(0.500f, 0.50f, 8.33f, 8.33f)); _curve.AddKey(new Keyframe(0.540f, 1.03f, 12.05f, 12.05f)); _curve.AddKey(new Keyframe(0.568f, 1.18f, 0.31f, 0.31f)); _curve.AddKey(new Keyframe(0.604f, 1.04f, -5.03f, -5.03f)); _curve.AddKey(new Keyframe(0.645f, 0.93f, 0.36f, 0.36f)); _curve.AddKey(new Keyframe(0.705f, 1.02f, 0.39f, 0.39f)); _curve.AddKey(new Keyframe(0.786f, 0.99f, -0.04f, -0.04f)); _curve.AddKey(new Keyframe(0.848f, 1.00f, 0.04f, 0.04f)); _curve.AddKey(new Keyframe(0.900f, 1.00f, -0.01f, -0.01f)); _curve.AddKey(new Keyframe(1.000f, 1.00f, 0.00f, 0.00f)); break; } return(_curve); }
void MoveUI(RectTransform _traansform, Vector2 position, float moveTime, float delayTime, Ease ease) { _traansform.DOAnchorPos(position, moveTime).SetDelay(delayTime).SetEase(ease); }
public static IEnumerator ScaleFrom(this Transform transform, Vector3 target, float duration, EaseType ease) { return(ScaleFrom(transform, target, duration, Ease.FromType(ease))); }
public virtual void OnOtherThanCenter(float animationTime, Ease easeType) { }
public virtual void OnInDisplay(float animationTime, Ease easeType, Action onFinished) { }
public unsafe void Reposition(float angle, float duration, Ease ease) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) TweenSettingsExtensions.SetEase <Tweener>(DOVirtual.Float(m_oscillationPhase, angle, duration, new TweenCallback <float>((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/)), ease); }
public override void Update(double time, Game game) { List <Chart.EventInfo> deadEvents = new List <Chart.EventInfo>(); foreach (Chart.EventInfo eventInfo in events) { if (eventInfo.time <= chart.beat) { float x = 0; float y = 0; float collumn; float targetx = 0; float targety = 0; //run the event n shit easing tempEaseing = new easing(); switch (eventInfo.name) { case "moveWindow": //data="50 50" x = float.Parse(eventInfo.data.Split(' ')[0]); y = float.Parse(eventInfo.data.Split(' ')[1]); moveWindow(x, y); break; case "moveWindowEase": //firstx, firsty, targetx, targety, easing, time x = float.Parse(eventInfo.data.Split(' ')[0]); y = float.Parse(eventInfo.data.Split(' ')[1]); targetx = float.Parse(eventInfo.data.Split(' ')[2]); targety = float.Parse(eventInfo.data.Split(' ')[3]); moveWindowEase(x, y, targetx, targety, eventInfo.time, float.Parse(eventInfo.data.Split(' ')[5]), eventInfo.data.Split(' ')[4]);; break; case "moveCollumn": //collumn, offsetX, offsetY (both based off ~~current loc~~ starting loc) collumn = float.Parse((eventInfo).data.Split(' ')[0]); targetx = float.Parse((eventInfo).data.Split(' ')[1]); targety = float.Parse((eventInfo).data.Split(' ')[2]); moveCollumn((int)collumn, (int)targetx, (int)targety); break; case "moveAllCollumn": //offsetX, offsetY targetx = float.Parse((eventInfo.data.Split(' ')[0])); targety = float.Parse((eventInfo).data.Split(' ')[1]); for (int i = 0; i < 4; i++) { moveCollumn(i, (int)targetx, (int)targety); } break; case "moveCollumnEase": //collumn, startX, startY, endX, endY, type, duration x = float.Parse(eventInfo.data.Split(' ')[1]); y = float.Parse(eventInfo.data.Split(' ')[2]); targetx = float.Parse(eventInfo.data.Split(' ')[3]); targety = float.Parse(eventInfo.data.Split(' ')[4]); moveCollumnEase(int.Parse(eventInfo.data.Split(' ')[0]), (int)x, (int)y, (int)targetx, (int)targety, eventInfo.time, float.Parse(eventInfo.data.Split(' ')[6]), eventInfo.data.Split(' ')[5]); break; case "moveAllCollumnEase": //x y targetx targety ease time x = float.Parse(eventInfo.data.Split(' ')[0]); y = float.Parse(eventInfo.data.Split(' ')[1]); targetx = float.Parse(eventInfo.data.Split(' ')[2]); targety = float.Parse(eventInfo.data.Split(' ')[3]); //NOTE:THIS IS A MASSIVE SECURITY FLAW. IF THIS WAS NOT JUST A GAME FOR SCHOOL WHERE IM GIVING ALL THE CHARTS N STUFF I WOULD NEVER DO THIS //MethodInfo method = typeof(float).GetMethod(eventInfo.data.Split(' ')[4]); //I really should replace with a switch case... //f**k it dictionary for (int i = 0; i < 4; i++) { moveCollumnEase(i, (int)x, (int)y, (int)targetx, (int)targety, eventInfo.time, float.Parse(eventInfo.data.Split(' ')[5]), eventInfo.data.Split(' ')[4]); } break; case "setCollumnAngle": //collumn, angle (0-360) setCollumnAngle(int.Parse(eventInfo.data.Split(' ')[0]), float.Parse(eventInfo.data.Split(' ')[1])); break; case "setCollumnAngleEase": //collumn, startangle, endangle, ease, time setCollumnAngleEase(int.Parse(eventInfo.data.Split(' ')[0]), float.Parse(eventInfo.data.Split(' ')[1]), float.Parse(eventInfo.data.Split(' ')[2]), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[4]), eventInfo.data.Split(' ')[3]); break; case "setAllCollumnAngle": //angle for (int i = 0; i < 4; i++) { setCollumnAngle(i, int.Parse(eventInfo.data)); } break; case "setAllCollumnAngleEase": //startangle, endangle, ease, time for (int i = 0; i < 4; i++) { setCollumnAngleEase(i, float.Parse(eventInfo.data.Split(' ')[0]), float.Parse(eventInfo.data.Split(' ')[1]), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[3]), eventInfo.data.Split(' ')[2]); } break; case "relativeAllCollumnEase": //xoffset, yoffset, ease, time //x = float.Parse(eventInfo.data.Split(' ')[0]); //y = float.Parse(eventInfo.data.Split(' ')[1]); targetx = float.Parse(eventInfo.data.Split(' ')[0]); targety = float.Parse(eventInfo.data.Split(' ')[1]); //NOTE:THIS IS A MASSIVE SECURITY FLAW. IF THIS WAS NOT JUST A GAME FOR SCHOOL WHERE IM GIVING ALL THE CHARTS N STUFF I WOULD NEVER DO THIS //MethodInfo method = typeof(float).GetMethod(eventInfo.data.Split(' ')[4]); //I really should replace with a switch case... //f**k it dictionary for (int i = 0; i < 4; i++) { moveCollumnEase(i, receivers[i].xOffset, receivers[i].yOffset, (int)(targetx + receivers[i].xOffset), (int)(targety + receivers[i].yOffset), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[3]), eventInfo.data.Split(' ')[2]); } break; case "relativeAllCollumnMove": targetx = float.Parse(eventInfo.data.Split(' ')[0]); targety = float.Parse(eventInfo.data.Split(' ')[1]); for (int i = 0; i < 4; i++) { moveCollumn(i, (int)targetx + receivers[i].xOffset, (int)targety + receivers[i].yOffset); } break; case "freezeCollumnArrows": //collumn, 0/1 //0= unfrozen //1 = frozen int col = int.Parse(eventInfo.data.Split(' ')[0]); int frozena = int.Parse(eventInfo.data.Split(' ')[1]); if (frozena == 0) { receivers[col].frozen = false; } else { receivers[col].frozen = true; } break; case "freezeAllCollumnArrows": int frozenb = int.Parse(eventInfo.data); for (int i = 0; i < 4; i++) { if (frozenb == 0) { receivers[i].frozen = false; } else { receivers[i].frozen = true; } } break; case "relativeCollumnEase": //col, targetx, targety, ease, time //x = float.Parse(eventInfo.data.Split(' ')[1]); //y = float.Parse(eventInfo.data.Split(' ')[2]); targetx = float.Parse(eventInfo.data.Split(' ')[1]); targety = float.Parse(eventInfo.data.Split(' ')[2]); moveCollumnEase(int.Parse(eventInfo.data.Split(' ')[0]), receivers[int.Parse(eventInfo.data.Split(' ')[0])].xOffset, receivers[int.Parse(eventInfo.data.Split(' ')[0])].yOffset, (int)(receivers[int.Parse(eventInfo.data.Split(' ')[0])].xOffset + targetx), (int)(receivers[int.Parse(eventInfo.data.Split(' ')[0])].yOffset + targety), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[4]), eventInfo.data.Split(' ')[3]); break; case "relativeCollumnAngleEase": //collumn, targetX, ease, time int tempcol = int.Parse(eventInfo.data.Split(' ')[0]); setCollumnAngleEase(tempcol, receivers[tempcol].rot * 360, (receivers[tempcol].rot * 360) + float.Parse(eventInfo.data.Split(' ')[1]), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[3]), eventInfo.data.Split(' ')[2]); break; case "relativeAllAngleEase": // endangle, ease, time for (int i = 0; i < 4; i++) { setCollumnAngleEase(i, receivers[i].rot * 360, (receivers[i].rot * 360) + float.Parse(eventInfo.data.Split(' ')[0]), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[3]), eventInfo.data.Split(' ')[2]); } break; case "setMovementAmount": Arrow.movementAmount = float.Parse(eventInfo.data.Split(' ')[0]); break; case "setCollumnModPercent": //col, mod, percent setCollumnMod(int.Parse(eventInfo.data.Split(' ')[0]), eventInfo.data.Split(' ')[1], float.Parse(eventInfo.data.Split(' ')[2])); break; case "setModPercent": //mod, percent setModPercent(eventInfo.data.Split(' ')[0], float.Parse(eventInfo.data.Split(' ')[1])); break; case "setModPercentEase": //mod, startpercent, endpercent, ease, time for (int i = 0; i < 4; i++) { setColPercentEase(i, eventInfo.data.Split(' ')[0], float.Parse(eventInfo.data.Split(' ')[1]), float.Parse(eventInfo.data.Split(' ')[2]), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[4]), eventInfo.data.Split(' ')[3]); } break; case "setCollumnModPercentEase": //col mod, startpercent, endpercent, ease, time setColPercentEase(int.Parse(eventInfo.data.Split(' ')[0]), eventInfo.data.Split(' ')[1], float.Parse(eventInfo.data.Split(' ')[2]), float.Parse(eventInfo.data.Split(' ')[3]), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[5]), eventInfo.data.Split(' ')[4]); break; case "setMovementAmountEase": //start end ease time setMovementAmountEase(float.Parse(eventInfo.data.Split(' ')[0]), float.Parse(eventInfo.data.Split(' ')[1]), eventInfo.time, float.Parse(eventInfo.data.Split(' ')[3]), eventInfo.data.Split(' ')[2]); break; case "BPMChange": chart.changeBPM(float.Parse(eventInfo.data), eventInfo.time); break; //THIS EVENT IS VOLITALE. IT IS MEANT TO **BREAK THE GAME** case "changeScreenX": windowManager.wwidth1 = int.Parse(eventInfo.data); break; case "changeScreenXEase": //old, new, easing, time tempEaseing.startValueX = int.Parse(eventInfo.data.Split(' ')[0]); tempEaseing.endValueX = int.Parse(eventInfo.data.Split(' ')[1]); tempEaseing.easingType = eventInfo.data.Split(' ')[2]; tempEaseing.startTime = eventInfo.time; tempEaseing.endTime = eventInfo.time + float.Parse(eventInfo.data.Split(' ')[3]); tempEaseing.objectType = easeType.screenX; easings.Add(tempEaseing); break; default: break; } deadEvents.Add(eventInfo); } } foreach (var item in deadEvents) { events.Remove(item); } List <easing> toDie = new List <easing>(); //run through easings foreach (var item in easings) { if (item.objectType == easeType.window) { if (chart.beat >= item.endTime) { windowManager.moveWindow(item.endValueX, item.endValueY); //float hm = Ease.byName[item.easingType](chart.beat - item.startTime, item.endTime - item.startTime, item.startValueX, item.endValueX)/1.6f; toDie.Add(item); } else { //ease basically takes a percent float temptest = (chart.beat - item.startTime) / (item.endTime - item.startTime); windowManager.moveWindow(Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime))), Ease.Lerp(item.startValueY, item.endValueY, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime)))); } } else if (item.objectType == easeType.collumn) { //ease basically takes a percent receivers[item.receiver].xOffset = (int)Math.Round(Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime)))); receivers[item.receiver].yOffset = (int)Math.Round(Ease.Lerp(item.startValueY, item.endValueY, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime)))); //windowManager.moveWindow(Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime))), Ease.Lerp(item.startValueY, item.endValueY, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime)))); //is having this after a good idea? maybe? should I have it like this on the other easings?? how do I even test for fuckups?!?!?!? //FOUND THE FUCKUP! Make sure this sets us to the end if (chart.beat >= item.endTime) { receivers[item.receiver].xOffset = (int)item.endValueX; receivers[item.receiver].yOffset = (int)item.endValueY; toDie.Add(item); } } else if (item.objectType == easeType.rotation) { if (chart.beat >= item.endTime) { //receivers[item.receiver].rot = item.endValueX; toDie.Add(item); } else { //ease basically takes a percent receivers[item.receiver].rot = Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime))); //windowManager.moveWindow(Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime))), Ease.Lerp(item.startValueY, item.endValueY, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime)))); } } else if (item.objectType == easeType.mod) { if (chart.beat >= item.endTime) { toDie.Add(item); } else { receivers[item.receiver].mods[item.modName] = Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType]((chart.beat - item.startTime) / (item.endTime - item.startTime))); } } else if (item.objectType == easeType.movementAmount) { if (chart.beat >= item.endTime) { toDie.Add(item); } else { Arrow.movementAmount = Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType](chart.beat - item.startTime) / (item.endTime - item.startTime)); } } else if (item.objectType == easeType.screenX) { if (chart.beat >= item.endTime) { toDie.Add(item); windowManager.wwidth1 = (int)item.endValueX; } else { windowManager.wwidth1 = (int)Math.Round(Ease.Lerp(item.startValueX, item.endValueX, Ease.byName[item.easingType](chart.beat - item.startTime) / (item.endTime - item.startTime))); } } } foreach (var item in toDie) { easings.Remove(item); } }
public static float EaseResult(Ease easingFunction, float start, float end, float value) { Function func = GetEasingFunction(easingFunction); return(func(start, end, value)); }
public static float EaseTo(this float start, float end, float value, Ease easeType = Ease.Linear) { return(Easing.Ease(start, end, value, easeType)); }
public static IEnumerator RotateFrom(this Transform transform, Quaternion target, float duration, EaseType ease) { return(RotateFrom(transform, target, duration, Ease.FromType(ease))); }
public static void animScaleSeqInsert(ref Sequence seq, float insTime, GameObject obj, float duration, Ease easeType, Vector3 animTo, float delay) { seq.Insert(insTime, DOTween.To(()=> obj.transform.localScale, x=> obj.transform.localScale = x, animTo, duration).SetEase(easeType).SetUpdate(false).SetDelay(delay) ); }
void OnGUI() { titleContent = new GUIContent("Ease: " + (oData.time_numbering ? TimelineWindow.frameToTime(key.frame, (float)aData.currentTake.frameRate) + " s" : key.frame.ToString())); TimelineWindow.loadSkin(ref skin, ref cachedSkinName, position); bool updateEasingCurve = false; GUIStyle styleBox = new GUIStyle(GUI.skin.button); styleBox.normal = GUI.skin.button.active; styleBox.hover = styleBox.normal; styleBox.border = GUI.skin.button.border; GUILayout.BeginArea(new Rect(5f, 5f, position.width - 10f, position.height - 10f)); GUILayout.BeginHorizontal(); if (GUILayout.Button("", styleBox, GUILayout.Width(500f), GUILayout.Height(100f))) { selectedSpeedIndex = (selectedSpeedIndex + 1) % speedValues.Length; percent = waitPercent * -1f; } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); int prevCategory = category; bool updatedSelectedIndex = false; if (setCategory(GUILayout.SelectionGrid(category, categories, (position.width >= 715f ? 12 : 6), GUILayout.Width(position.width - 16f)))) { selectedIndex = getSelectedEaseIndex(prevCategory, selectedIndex); selectedIndex = getCategoryIndexForEase(selectedIndex); if (selectedIndex < 1) { selectedIndex = 1; percent = waitPercent * -1f; updatedSelectedIndex = true; } } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginVertical(GUILayout.Height(233f)); if (updatedSelectedIndex || setSelectedIndex(GUILayout.SelectionGrid(selectedIndex, easeTypesFiltered[category].ToArray(), 3))) { percent = waitPercent * -1f; updateEasingCurve = true; if (getSelectedEaseName(category, selectedIndex) == "Custom") { isCustomEase = true; if (key.customEase.Count > 0) { curve = key.getCustomEaseCurve(); } else { setEasingCurve(); } } else { isCustomEase = false; } } GUILayout.EndVertical(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); if (GUILayout.Button("Apply")) { Ease nease = (Ease)TimelineWindow.GetEaseIndex(getSelectedEaseIndex(category, selectedIndex)); bool shouldUpdateCache = false; if (isCustomEase) { key.setCustomEase(curve); shouldUpdateCache = true; } if (key.easeType != nease) { shouldUpdateCache = true; } if (shouldUpdateCache) { aData.RegisterTakesUndo("Change Ease", false); key.setEaseType(nease); // update cache when modifying varaibles track.updateCache(aData.target); // preview new position aData.currentTake.previewFrame(aData.target, aData.currentTake.selectedFrame); } this.Close(); } if (GUILayout.Button("Cancel")) { this.Close(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); // orb texture GUI.DrawTexture(new Rect(x_pos, 15f, 80f, 80f), tex_orb); // speed label GUIStyle styleLabelRight = new GUIStyle(GUI.skin.label); styleLabelRight.alignment = TextAnchor.MiddleRight; styleLabelRight.normal.textColor = Color.white; EditorGUI.DropShadowLabel(new Rect(475f, 5f, 25f, 25f), speedNames[selectedSpeedIndex], styleLabelRight); // draw border GUI.color = GUI.skin.window.normal.textColor; GUI.DrawTexture(new Rect(0f, 0f, 7f, 110f), EditorGUIUtility.whiteTexture); GUI.DrawTexture(new Rect(position.width - 209f, 0f, 208f, 110f), EditorGUIUtility.whiteTexture); GUI.color = Color.white; // curve field if (updateEasingCurve) { setEasingCurve(); } else if (!isCustomEase && didChangeCurve()) { isCustomEase = true; selectedIndex = getCategoryIndexForEaseName("Custom"); if (selectedIndex < 0) { category = 0; selectedIndex = getCategoryIndexForEaseName("Custom"); } } curve = EditorGUI.CurveField(new Rect(500f, 5f, 208f, 100f), curve); }
public Color32MemberCurve(string propName, Ease ease, float dur, Color32 start, Color32 end) : base(propName, ease, dur) { _start = start; _end = end; }
public TweenHash From(string memberName, Ease ease, object start, float dur, object option = null) { _props.Add(new PropInfo(AnimMode.From, memberName, ease, start, dur, option)); return this; }
/// <summary> /// Creates a curve that will animate from the current value to the end value, but will rescale the duration from how long it should have /// taken from start to end, but already animated up to current. /// </summary> /// <param name="memberName"></param> /// <param name="ease"></param> /// <param name="start"></param> /// <param name="end"></param> /// <param name="dur"></param> /// <param name="option"></param> /// <returns></returns> public TweenHash RedirectTo(string memberName, Ease ease, object start, object end, float dur, object option = null) { _props.Add(new PropInfo(AnimMode.RedirectTo, memberName, ease, start, dur, option, end)); return this; }
public static EasingMethod GetEasingMethod(Easing easing, Ease ease) { return(EasingMethods[(short)easing, (short)ease]); }
public PropInfo(AnimMode mode, string nm, Ease e, object v, float d, object option, object altV) { this.mode = mode; this.name = nm; this.ease = e; this.value = v; this.dur = d; this.altValue = altV; this.option = option; }
/// <summary> /// Creates a vibration that fades out. /// </summary> /// <param name="leftMotor">The speed of the left, low-frequency motor in [0, 1].</param> /// <param name="rightMotor">The speed of the right, high-frequency motor in [0, 1].</param> /// <param name="duration">The duration, in seconds, to vibrate for.</param> /// <param name="easing">The easing function between the vibration values.</param> /// <returns>A vibration function.</returns> public static Vibration FadeOut(float leftMotor, float rightMotor, float duration, Ease easing) { return(InterpolateVibration(new Vector2(leftMotor, rightMotor), Vector2.Zero, easing, duration)); }
public static IEnumerator CurveFrom(this Transform transform, Vector3 control, Vector3 start, float duration, EaseType ease) { return(CurveFrom(transform, control, start, duration, Ease.FromType(ease))); }
public static void animScale(GameObject obj, float duration, Ease easeType, Vector3 animTo, float delay) { DOTween.To(()=> obj.transform.localScale, x=> obj.transform.localScale = x, animTo, duration).SetEase(easeType).SetUpdate(false).SetDelay(delay); }
public static float EasedValue(float from, float to, float lifetimePercentage, Ease easeType, float overshoot) { return(from + (to - from) * EaseManager.Evaluate(easeType, null, lifetimePercentage, 1f, overshoot, DOTween.defaultEasePeriod)); }
public virtual void OnFirstDisplay(float animationTime, bool isCenter, Ease easeType) { }
// ######################################## // EaseType Converter Functions // ######################################## #region EaseType Converter Functions #if USE_DOTWEEN // use DOTween: https://www.assetstore.unity3d.com/en/#!/content/27676 Documentation: http://dotween.demigiant.com/documentation.php // DOTween: https://www.assetstore.unity3d.com/en/#!/content/27676 // DOTween Documentation: http://dotween.demigiant.com/documentation.php public static Ease DOTweenEaseType(eEaseType easeType) { Ease result = Ease.Linear; switch (easeType) { case eEaseType.InQuad: result = Ease.InQuad; break; case eEaseType.OutQuad: result = Ease.OutQuad; break; case eEaseType.InOutQuad: result = Ease.InOutQuad; break; case eEaseType.InCubic: result = Ease.OutCubic; break; case eEaseType.OutCubic: result = Ease.OutCubic; break; case eEaseType.InOutCubic: result = Ease.InOutCubic; break; case eEaseType.InQuart: result = Ease.InQuart; break; case eEaseType.OutQuart: result = Ease.OutQuart; break; case eEaseType.InOutQuart: result = Ease.InOutQuart; break; case eEaseType.InQuint: result = Ease.InQuint; break; case eEaseType.OutQuint: result = Ease.OutQuint; break; case eEaseType.InOutQuint: result = Ease.InOutQuint; break; case eEaseType.InSine: result = Ease.InSine; break; case eEaseType.OutSine: result = Ease.OutSine; break; case eEaseType.InOutSine: result = Ease.InOutSine; break; case eEaseType.InExpo: result = Ease.InExpo; break; case eEaseType.OutExpo: result = Ease.OutExpo; break; case eEaseType.InOutExpo: result = Ease.InOutExpo; break; case eEaseType.InCirc: result = Ease.InCirc; break; case eEaseType.OutCirc: result = Ease.OutCirc; break; case eEaseType.InOutCirc: result = Ease.InOutCirc; break; case eEaseType.linear: result = Ease.Linear; break; case eEaseType.InBounce: result = Ease.InBounce; break; case eEaseType.OutBounce: result = Ease.OutBounce; break; case eEaseType.InOutBounce: result = Ease.InOutBounce; break; case eEaseType.InBack: result = Ease.InBack; break; case eEaseType.OutBack: result = Ease.OutBack; break; case eEaseType.InOutBack: result = Ease.InOutBack; break; case eEaseType.InElastic: result = Ease.InElastic; break; case eEaseType.OutElastic: result = Ease.OutElastic; break; case eEaseType.InOutElastic: result = Ease.InOutElastic; break; default: result = Ease.Linear; break; } return(result); }
public static void animRotationCallbackU(GameObject obj, float duration, Ease easeType, Vector3 animTo, bool relative, TweenCallback onUpd) { obj.transform.DOLocalRotate(animTo, duration, RotateMode.FastBeyond360).SetEase(easeType).SetUpdate(false).SetRelative(relative) .OnUpdate(onUpd); }
/// <summary> /// Returns the function associated to the easingFunction enum. This value returned should be cached as it allocates memory /// to return. /// </summary> /// <param name="easingFunction">The enum associated with the easing function.</param> /// <returns>The easing function</returns> public static Function GetEasingFunction(Ease easingFunction) { if (easingFunction == Ease.EaseInQuad) { return(EaseInQuad); } if (easingFunction == Ease.EaseOutQuad) { return(EaseOutQuad); } if (easingFunction == Ease.EaseInOutQuad) { return(EaseInOutQuad); } if (easingFunction == Ease.EaseInCubic) { return(EaseInCubic); } if (easingFunction == Ease.EaseOutCubic) { return(EaseOutCubic); } if (easingFunction == Ease.EaseInOutCubic) { return(EaseInOutCubic); } if (easingFunction == Ease.EaseInQuart) { return(EaseInQuart); } if (easingFunction == Ease.EaseOutQuart) { return(EaseOutQuart); } if (easingFunction == Ease.EaseInOutQuart) { return(EaseInOutQuart); } if (easingFunction == Ease.EaseInQuint) { return(EaseInQuint); } if (easingFunction == Ease.EaseOutQuint) { return(EaseOutQuint); } if (easingFunction == Ease.EaseInOutQuint) { return(EaseInOutQuint); } if (easingFunction == Ease.EaseInSine) { return(EaseInSine); } if (easingFunction == Ease.EaseOutSine) { return(EaseOutSine); } if (easingFunction == Ease.EaseInOutSine) { return(EaseInOutSine); } if (easingFunction == Ease.EaseInExpo) { return(EaseInExpo); } if (easingFunction == Ease.EaseOutExpo) { return(EaseOutExpo); } if (easingFunction == Ease.EaseInOutExpo) { return(EaseInOutExpo); } if (easingFunction == Ease.EaseInCirc) { return(EaseInCirc); } if (easingFunction == Ease.EaseOutCirc) { return(EaseOutCirc); } if (easingFunction == Ease.EaseInOutCirc) { return(EaseInOutCirc); } if (easingFunction == Ease.Linear) { return(Linear); } if (easingFunction == Ease.Spring) { return(Spring); } if (easingFunction == Ease.EaseInBounce) { return(EaseInBounce); } if (easingFunction == Ease.EaseOutBounce) { return(EaseOutBounce); } if (easingFunction == Ease.EaseInOutBounce) { return(EaseInOutBounce); } if (easingFunction == Ease.EaseInBack) { return(EaseInBack); } if (easingFunction == Ease.EaseOutBack) { return(EaseOutBack); } if (easingFunction == Ease.EaseInOutBack) { return(EaseInOutBack); } if (easingFunction == Ease.EaseInBackDouble) { return(EaseInBackDouble); } if (easingFunction == Ease.EaseOutBackDouble) { return(EaseOutBackDouble); } if (easingFunction == Ease.EaseInElastic) { return(EaseInElastic); } if (easingFunction == Ease.EaseOutElastic) { return(EaseOutElastic); } if (easingFunction == Ease.EaseInOutElastic) { return(EaseInOutElastic); } return(null); }
public static void animScaleCallbackC(GameObject obj, float duration, Ease easeType, Vector3 animTo, TweenCallback onComp) { DOTween.To(()=> obj.transform.localScale, x=> obj.transform.localScale = x, animTo, duration).SetEase(easeType).SetUpdate(false) .OnComplete(onComp); }
/// <summary> /// Gets the derivative function of the appropriate easing function. If you use an easing function for position then this /// function can get you the speed at a given time (normalized). /// </summary> /// <param name="easingFunction"></param> /// <returns>The derivative function</returns> public static Function GetEasingFunctionDerivative(Ease easingFunction) { if (easingFunction == Ease.EaseInQuad) { return(EaseInQuadD); } if (easingFunction == Ease.EaseOutQuad) { return(EaseOutQuadD); } if (easingFunction == Ease.EaseInOutQuad) { return(EaseInOutQuadD); } if (easingFunction == Ease.EaseInCubic) { return(EaseInCubicD); } if (easingFunction == Ease.EaseOutCubic) { return(EaseOutCubicD); } if (easingFunction == Ease.EaseInOutCubic) { return(EaseInOutCubicD); } if (easingFunction == Ease.EaseInQuart) { return(EaseInQuartD); } if (easingFunction == Ease.EaseOutQuart) { return(EaseOutQuartD); } if (easingFunction == Ease.EaseInOutQuart) { return(EaseInOutQuartD); } if (easingFunction == Ease.EaseInQuint) { return(EaseInQuintD); } if (easingFunction == Ease.EaseOutQuint) { return(EaseOutQuintD); } if (easingFunction == Ease.EaseInOutQuint) { return(EaseInOutQuintD); } if (easingFunction == Ease.EaseInSine) { return(EaseInSineD); } if (easingFunction == Ease.EaseOutSine) { return(EaseOutSineD); } if (easingFunction == Ease.EaseInOutSine) { return(EaseInOutSineD); } if (easingFunction == Ease.EaseInExpo) { return(EaseInExpoD); } if (easingFunction == Ease.EaseOutExpo) { return(EaseOutExpoD); } if (easingFunction == Ease.EaseInOutExpo) { return(EaseInOutExpoD); } if (easingFunction == Ease.EaseInCirc) { return(EaseInCircD); } if (easingFunction == Ease.EaseOutCirc) { return(EaseOutCircD); } if (easingFunction == Ease.EaseInOutCirc) { return(EaseInOutCircD); } if (easingFunction == Ease.Linear) { return(LinearD); } if (easingFunction == Ease.Spring) { return(SpringD); } if (easingFunction == Ease.EaseInBounce) { return(EaseInBounceD); } if (easingFunction == Ease.EaseOutBounce) { return(EaseOutBounceD); } if (easingFunction == Ease.EaseInOutBounce) { return(EaseInOutBounceD); } if (easingFunction == Ease.EaseInBack) { return(EaseInBackD); } if (easingFunction == Ease.EaseOutBack) { return(EaseOutBackD); } if (easingFunction == Ease.EaseInOutBack) { return(EaseInOutBackD); } if (easingFunction == Ease.EaseInElastic) { return(EaseInElasticD); } if (easingFunction == Ease.EaseOutElastic) { return(EaseOutElasticD); } if (easingFunction == Ease.EaseInOutElastic) { return(EaseInOutElasticD); } return(null); }
public static void animSize(GameObject obj, float duration, Ease easeType, Vector2 animTo) { RectTransform comp = obj.GetComponent<RectTransform>(); DOTween.To(()=> comp.sizeDelta, x=> comp.sizeDelta = x, animTo, duration).SetEase(easeType).SetUpdate(false); }
public static Vector2 EaseVector2(Ease ease, Vector2 start, Vector2 end, float t, float dur) { return((ease(t, 0, 1, dur) * (end - start)) + start); //return new Vector2(ease(t, start.x, end.x - start.x, dur), ease(t, start.y, end.y - start.y, dur)); }
public TweenHash Ease(Ease ease) { _defaultEase = ease ?? EaseMethods.LinearEaseNone; return this; }
public static Vector4 EaseVector3(Ease ease, Vector4 start, Vector4 end, float t, float dur) { return((ease(t, 0, 1, dur) * (end - start)) + start); //return new Vector4(ease(t, start.x, end.x - start.x, dur), ease(t, start.y, end.y - start.y, dur), ease(t, start.z, end.z - start.z, dur), ease(t, start.w, end.w - start.w, dur)); }
ITweenHash ITweenHash.Ease(Ease ease) { return this.Ease(ease); }
public static Quaternion EaseQuaternion(Ease ease, Quaternion start, Quaternion end, float t, float dur) { return(Quaternion.Slerp(start, end, ease(t, 0, 1, dur))); }
public TweenHash To(string memberName, Ease ease, object end, float dur, object option = null) { _props.Add(new PropInfo(AnimMode.To, memberName, ease, end, dur, option)); return this; }
public static float EasedLerp(Ease ease, float from, float to, float t) { return(ease(t, from, to - from, 1f)); }
public TweenHash By(string memberName, Ease ease, object amt, float dur, object option = null) { _props.Add(new PropInfo(AnimMode.By, memberName, ease, amt, dur, option)); return this; }
public override void Render() { base.Render(); string[] emotes = GhostNetModule.Settings.EmoteFavs; // Update can halt in the pause menu. if (Shown) { Angle = GhostNetModule.Instance.JoystickEmoteWheel.Value.Angle(); float angle = (float)((Angle + Math.PI * 2f) % (Math.PI * 2f)); float start = (-0.5f / emotes.Length) * 2f * (float)Math.PI; if (2f * (float)Math.PI + start < angle) { // Angle should be start < angle < 0, but is (TAU + start) < angle < TAU angle -= 2f * (float)Math.PI; } for (int i = 0; i < emotes.Length; i++) { float min = ((i - 0.5f) / emotes.Length) * 2f * (float)Math.PI; float max = ((i + 0.5f) / emotes.Length) * 2f * (float)Math.PI; if (min <= angle && angle <= max) { Selected = i; break; } } } time += Engine.RawDeltaTime; if (!Shown) { Selected = -1; } selectedTime += Engine.RawDeltaTime; if (PrevSelected != Selected) { selectedTime = 0f; PrevSelected = Selected; } float popupAlpha; float popupScale; popupTime += Engine.RawDeltaTime; if (Shown && !popupShown) { popupTime = 0f; } else if ((Shown && popupTime > 1f) || (!Shown && popupTime < 1f)) { popupTime = 1f; } popupShown = Shown; if (popupTime < 0.1f) { float t = popupTime / 0.1f; // Pop in. popupAlpha = Ease.CubeOut(t); popupScale = Ease.ElasticOut(t); } else if (popupTime < 1f) { // Stay. popupAlpha = 1f; popupScale = 1f; } else { float t = (popupTime - 1f) / 0.2f; // Fade out. popupAlpha = 1f - Ease.CubeIn(t); popupScale = 1f - 0.2f * Ease.CubeIn(t); } float alpha = Alpha * popupAlpha; if (alpha <= 0f) { return; } if (Tracking == null) { return; } Level level = SceneAs <Level>(); if (level == null) { return; } if (Camera == null) { Camera = level.Camera; } if (Camera == null) { return; } Vector2 pos = Tracking.Position; pos.Y -= 8f; pos -= level.Camera.Position; pos *= 6f; // 1920 / 320 float radius = BG.Width * 0.5f * 0.75f * popupScale; pos = pos.Clamp( 0f + radius, 0f + radius, 1920f - radius, 1080f - radius ); // Draw.Circle(pos, radius, Color.Black * 0.8f * alpha * alpha, radius * 0.6f * (1f + 0.2f * (float) Math.Sin(time)), 8); BG.DrawCentered( pos, Color.White * alpha * alpha * alpha, Vector2.One * popupScale ); Indicator.DrawCentered( pos, Color.White * alpha * alpha * alpha, Vector2.One * popupScale, Angle ); float selectedScale = 1.2f - 0.2f * Calc.Clamp(Ease.CubeOut(selectedTime / 0.1f), 0f, 1f) + (float)Math.Sin(time * 1.8f) * 0.05f; for (int i = 0; i < emotes.Length; i++) { Line.DrawCentered( pos, Color.White * alpha * alpha * alpha, Vector2.One * popupScale, ((i + 0.5f) / emotes.Length) * 2f * (float)Math.PI ); string emote = emotes[i]; if (string.IsNullOrEmpty(emote)) { continue; } float a = (i / (float)emotes.Length) * 2f * (float)Math.PI; Vector2 emotePos = pos + new Vector2( (float)Math.Cos(a), (float)Math.Sin(a) ) * radius; if (GhostNetEmote.IsIcon(emote)) { MTexture icon = GhostNetEmote.GetIcon(emote, Selected == i ? selectedTime : 0f); if (icon == null) { continue; } Vector2 iconSize = new Vector2(icon.Width, icon.Height); float iconScale = (GhostNetEmote.Size / Math.Max(iconSize.X, iconSize.Y)) * 0.24f * popupScale; icon.DrawCentered( emotePos, Color.White * (Selected == i ? (Calc.BetweenInterval(selectedTime, 0.1f) ? 0.9f : 1f) : 0.7f) * alpha, Vector2.One * (Selected == i ? selectedScale : 1f) * iconScale ); } else { Vector2 textSize = ActiveFont.Measure(emote); float textScale = (GhostNetEmote.Size / Math.Max(textSize.X, textSize.Y)) * 0.24f * popupScale; ActiveFont.DrawOutline( emote, emotePos, new Vector2(0.5f, 0.5f), Vector2.One * (Selected == i ? selectedScale : 1f) * textScale, (Selected == i ? (Calc.BetweenInterval(selectedTime, 0.1f) ? TextSelectColorA : TextSelectColorB) : Color.LightSlateGray) * alpha, 2f, Color.Black * alpha * alpha * alpha ); } } }