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:float
Colorthe current value
-
target:float
Colorthe value we are trying to reach
-
currentVelocity:float
Colorthe current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:float
Floatthe current value
-
target:float
Floatthe value we are trying to reach
-
currentVelocity:float
Floatthe current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:float
Vector3the current value
-
target:float
Vector3the value we are trying to reach
-
currentVelocity:float
Vector3the current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:Color
Floatthe current value
-
target:Color
Floatthe value we are trying to reach
-
currentVelocity:Color
Floatthe current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:float
Floatthe current value
-
target:float
Floatthe value we are trying to reach
-
currentVelocity:float
Floatthe current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:Vector3
Floatthe current value
-
target:Vector3
Floatthe value we are trying to reach
-
currentVelocity:Vector3
Floatthe current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:float
Colorthe current value
-
target:float
Colorthe value we are trying to reach
-
moveSpeed:float
Floatthe speed at which to move towards the target
-
deltaTime:float
Floatthe 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:float
Floatthe current value
-
target:float
Floatthe value we are trying to reach
-
moveSpeed:float
Floatthe speed at which to move towards the target
-
deltaTime:float
Floatthe 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:float
Vector3the current value
-
target:float
Vector3the value we are trying to reach
-
moveSpeed:float
Floatthe speed at which to move towards the target
-
deltaTime:float
Floatthe 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:float
Colorthe current value
-
target:float
Colorthe value we are trying to reach
-
currentVelocity:float
Colorthe current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:float
Floatthe current value
-
target:float
Floatthe value we are trying to reach
-
currentVelocity:float
Floatthe current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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:float
Vector3the current value
-
target:float
Vector3the value we are trying to reach
-
currentVelocity:float
Vector3the current velocity of the value
-
smoothTime:float
Floatroughly the time it takes to reach the destination
-
maxSpeed:float
Floatthe top speed you want the value to move at (defaults to unlimited -1f)
-
deltaTime:float
Floatthe 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);