LeanSmooth Class
Use these smooth methods to move one value towards another
Example:
fromY = LeanSmooth.spring(fromY, followArrow.localPosition.y, ref velocityY, 1.1f);
fromVec3 = LeanSmooth.damp(fromVec3, dude5Title.localPosition, ref velocityVec3, 1.1f);
fromColor = LeanSmooth.damp(fromColor, dude5Title.GetComponent
Debug.Log("Smoothed y:" + fromY + " vec3:" + fromVec3 + " color:" + fromColor);
Item Index
Methods
- LeanSmooth.bounceOut (Color)
- LeanSmooth.bounceOut (float)
- LeanSmooth.bounceOut (Vector3)
- LeanSmooth.damp (Color)
- LeanSmooth.damp (float)
- LeanSmooth.damp (Vector3)
- LeanSmooth.linear (Color)
- LeanSmooth.linear (float)
- LeanSmooth.linear (Vector3)
- LeanSmooth.spring (Color)
- LeanSmooth.spring (float)
- LeanSmooth.spring (Vector3)
Methods
LeanSmooth.bounceOut (Color)
-
current:float -
target:float -
currentVelocity:float -
smoothTime:float -
maxSpeed:float -
deltaTime:float -
[friction] -
[accelRate] -
[hitDamping]
Parameters:
-
current:floatColorthe current value
-
target:floatColorthe value we are trying to reach
-
currentVelocity:floatColorthe current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
-
[friction]Float optional:float rate at which the spring is slowed down once it reaches it's destination
-
[accelRate]Float optional:float the rate it accelerates from it's initial position
-
[hitDamping]Float optional:float the rate at which to dampen the bounciness of when it reaches it's destination
Example:
fromColor = LeanSmooth.bounceOut(fromColor, transform.GetComponent
LeanSmooth.bounceOut (float)
-
current:float -
target:float -
currentVelocity:float -
smoothTime:float -
maxSpeed:float -
deltaTime:float -
[friction] -
[accelRate] -
[hitDamping]
Parameters:
-
current:floatFloatthe current value
-
target:floatFloatthe value we are trying to reach
-
currentVelocity:floatFloatthe current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
-
[friction]Float optional:float rate at which the spring is slowed down once it reaches it's destination
-
[accelRate]Float optional:float the rate it accelerates from it's initial position
-
[hitDamping]Float optional:float the rate at which to dampen the bounciness of when it reaches it's destination
Example:
followVar = LeanSmooth.bounceOut(followVar, destinationVar, ref followVelocity, 1.1f);\n Debug.Log("current:"+followVar);
LeanSmooth.bounceOut (Vector3)
-
current:float -
target:float -
currentVelocity:float -
smoothTime:float -
maxSpeed:float -
deltaTime:float -
[friction] -
[accelRate] -
[hitDamping]
Parameters:
-
current:floatVector3the current value
-
target:floatVector3the value we are trying to reach
-
currentVelocity:floatVector3the current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
-
[friction]Float optional:float rate at which the spring is slowed down once it reaches it's destination
-
[accelRate]Float optional:float the rate it accelerates from it's initial position
-
[hitDamping]Float optional:float the rate at which to dampen the bounciness of when it reaches it's destination
Example:
transform.position = LeanSmooth.bounceOut(transform.position, followTrans.position, ref followVelocity, 1.1f);\n Debug.Log("current:"+transform.position);
LeanSmooth.damp (Color)
-
current:Color -
target:Color -
currentVelocity:Color -
smoothTime:float -
maxSpeed:float -
deltaTime:float
Parameters:
-
current:ColorFloatthe current value
-
target:ColorFloatthe value we are trying to reach
-
currentVelocity:ColorFloatthe current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
Example:
fromColor = LeanSmooth.damp(fromColor, transform.GetComponent
LeanSmooth.damp (float)
-
current:float -
target:float -
currentVelocity:float -
smoothTime:float -
maxSpeed:float -
deltaTime:float
Parameters:
-
current:floatFloatthe current value
-
target:floatFloatthe value we are trying to reach
-
currentVelocity:floatFloatthe current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
Example:
followVar = LeanSmooth.damp(followVar, destinationVar, ref followVelocity, 1.1f);\n Debug.Log("current:"+followVar);
LeanSmooth.damp (Vector3)
-
current:Vector3 -
target:Vector3 -
currentVelocity:Vector3 -
smoothTime:float -
maxSpeed:float -
deltaTime:float
Parameters:
-
current:Vector3Floatthe current value
-
target:Vector3Floatthe value we are trying to reach
-
currentVelocity:Vector3Floatthe current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
Example:
transform.position = LeanSmooth.damp(transform.position, destTrans.position, ref followVelocity, 1.1f);\n Debug.Log("current:"+transform.position);
LeanSmooth.linear (Color)
-
current:float -
target:float -
moveSpeed:float -
deltaTime:float
Parameters:
-
current:floatColorthe current value
-
target:floatColorthe value we are trying to reach
-
moveSpeed:floatFloatthe speed at which to move towards the target
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
Example:
fromColor = LeanSmooth.linear(fromColor, transform.GetComponent
LeanSmooth.linear (float)
-
current:float -
target:float -
moveSpeed:float -
deltaTime:float
Parameters:
-
current:floatFloatthe current value
-
target:floatFloatthe value we are trying to reach
-
moveSpeed:floatFloatthe speed at which to move towards the target
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
Example:
followVar = LeanSmooth.linear(followVar, destinationVar, 50f);\n Debug.Log("current:"+followVar);
LeanSmooth.linear (Vector3)
-
current:float -
target:float -
moveSpeed:float -
deltaTime:float
Parameters:
-
current:floatVector3the current value
-
target:floatVector3the value we are trying to reach
-
moveSpeed:floatFloatthe speed at which to move towards the target
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
Example:
transform.position = LeanSmooth.linear(transform.position, followTrans.position, 50f);\n Debug.Log("current:"+transform.position);
LeanSmooth.spring (Color)
-
current:float -
target:float -
currentVelocity:float -
smoothTime:float -
maxSpeed:float -
deltaTime:float -
[friction] -
[accelRate]
Parameters:
-
current:floatColorthe current value
-
target:floatColorthe value we are trying to reach
-
currentVelocity:floatColorthe current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
-
[friction]Float optional:float rate at which the spring is slowed down once it reaches it's destination
-
[accelRate]Float optional:float the rate it accelerates from it's initial position
Example:
fromColor = LeanSmooth.spring(fromColor, transform.GetComponent
LeanSmooth.spring (float)
-
current:float -
target:float -
currentVelocity:float -
smoothTime:float -
maxSpeed:float -
deltaTime:float -
[friction] -
[accelRate]
Parameters:
-
current:floatFloatthe current value
-
target:floatFloatthe value we are trying to reach
-
currentVelocity:floatFloatthe current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
-
[friction]Float optional:float rate at which the spring is slowed down once it reaches it's destination
-
[accelRate]Float optional:float the rate it accelerates from it's initial position
Example:
followVar = LeanSmooth.spring(followVar, destinationVar, ref followVelocity, 1.1f);\n Debug.Log("current:"+followVar);
LeanSmooth.spring (Vector3)
-
current:float -
target:float -
currentVelocity:float -
smoothTime:float -
maxSpeed:float -
deltaTime:float -
[friction] -
[accelRate]
Parameters:
-
current:floatVector3the current value
-
target:floatVector3the value we are trying to reach
-
currentVelocity:floatVector3the current velocity of the value
-
smoothTime:floatFloatroughly the time it takes to reach the destination
-
maxSpeed:floatFloatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:floatFloatthe difference in time since the method was called (defaults to Time.deltaTime)
-
[friction]Float optional:float rate at which the spring is slowed down once it reaches it's destination
-
[accelRate]Float optional:float the rate it accelerates from it's initial position
Example:
transform.position = LeanSmooth.spring(transform.position, destTrans.position, ref followVelocity, 1.1f);\n Debug.Log("current:"+transform.position);
