public static Color Average(Color c1, Color c2) { return(new Color( SRMath.Average(c1.r, c2.r), SRMath.Average(c1.g, c2.g), SRMath.Average(c1.b, c2.b), SRMath.Average(c1.a, c2.a) )); }
protected override void Update() { base.Update(); var from = Content.anchoredPosition.x; if (Mathf.Abs(_targetXPosition - from) < 2.5f) { Content.anchoredPosition = new Vector2(_targetXPosition, Content.anchoredPosition.y); } else { Content.anchoredPosition = new Vector2(SRMath.SpringLerp(from, _targetXPosition, 15f, Time.unscaledDeltaTime), Content.anchoredPosition.y); } }
protected override void Update() { base.Update(); var speed = ResetSpeed; if (_pointer.HasValue) { speed = InteractSpeed; _targetRotation = TargetRotation(_position, _camera); } else { _targetRotation = Quaternion.identity; } CachedTransform.localRotation = SRMath.SpringLerp(CachedTransform.localRotation, _targetRotation, speed, Time.unscaledDeltaTime); }
protected override void Update() { base.Update(); var speed = ResetSpeed; var targetScale = _initialScale; if (_isDown) { speed = InteractSpeed; if (Mult) { targetScale = Vector3Extensions.Multiply(_initialScale, Scale); } else { targetScale = Scale; } } CachedTransform.localScale = SRMath.SpringLerp(CachedTransform.localScale, targetScale, speed, Time.unscaledDeltaTime); }
public void GoToNext() { var currentIndex = Array.IndexOf(_values, _lastValue); SetIndex(SRMath.Wrap(_values.Length, currentIndex + 1)); }