Linear Interpolation: Difference between revisions
Added more information (merged "Basics of tweening" from the old wiki)
-u ndefined- (talk | contribs) m (Text replacement - "Category:Scripts" to "Category:Scripting") |
(Added more information (merged "Basics of tweening" from the old wiki)) |
||
Line 30: | Line 30: | ||
The Amount variable increases by 0.05 every frame, until it reaches 1, where it is limited by using [[Min]]. | The Amount variable increases by 0.05 every frame, until it reaches 1, where it is limited by using [[Min]]. | ||
== Non-linear interpolation == | |||
It is often useful to make the movement more believable by having some acceleration (making it non-linear) without the use of physics. | |||
Apart from interpolation, this technique is sometimes called tweening or easing. | |||
To do this, instead of using the Amount variable directly, it can be transformed first. | |||
You can raise it to some [[power]] or take a [[sin]] or use a function like <b>smoothstep</b>, which will make the movement smoothly accelerate and then decelerate; it looks like this: | |||
{{Image|Smoothstep.png}} | |||
{{Image|Smoothstep_graph.png}} | |||
You can experiment with such easing functions on your own or find some elsewhere on the internet or in Fancade, such as in [https://play.fancade.com/5E6AB5ADF3B3BC2F Easings] by [[Sounak9434]]. | |||
[[Category:Scripting]] | [[Category:Scripting]] |