public float GetCurrentRadius(float t, ref Vector2 radiusMap) { float normalizedLength = Mathf.InverseLerp(0f, Length, t); float valueCurveMapped = RadiusRemapCurve.Evaluate(normalizedLength); return(SpiralMath.Remap(valueCurveMapped, 1f, 0f, radiusMap.x, radiusMap.y)); }
private void UpdateOpacityOnMovement() { if (t <= OpacityInTRange.y) { float k = SpiralMath.Remap(t, OpacityInTRange.x, OpacityInTRange.y, 0f, 1f); SetOpacityForSlot(k); } else if (t >= OpacityOutTRange.x) { float k = SpiralMath.Remap(t, OpacityOutTRange.y, OpacityOutTRange.x, 0f, 1f); SetOpacityForSlot(k); } else { float k = 1f; SetOpacityForSlot(k); } }
// Update is called once per frame void Update() { if (Application.isPlaying) // in editor debug purposes { _actualLength += GlobalGestureCircle.DragMotion * 1.6f; _actualLength = Mathf.Max(0f, _actualLength); _targetLength = Mathf.Clamp(_actualLength, LengthRange.x, LengthRange.y); float clampedLength = Mathf.Clamp(_actualLength, LengthRange.x, LengthRange.y); Length = Mathf.SmoothDamp(clampedLength, _targetLength, ref _lengthGrowSpeed, 0.1f); } Length = Mathf.Clamp(Length, LengthRange.x, LengthRange.y); GameScreen.color = Color.white * SpiralMath.Remap(Length, 2f, 0f, 0.5f, 1f); CreateSpiral(); }