ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:lerp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
functions:lerp [2017/03/15 16:50] – created korshunfunctions:lerp [2017/03/15 16:51] (current) korshun
Line 13: Line 13:
 lerp(A, B, 1.0) -> B lerp(A, B, 1.0) -> B
 lerp(A, B, 0.5) -> (A + B) / 2 // Average of a and b. lerp(A, B, 0.5) -> (A + B) / 2 // Average of a and b.
 +</code>
 +
 +Simple animation of movement between two points:
 +<code>
 +for (int time = 0; time < 1.0; time += 0.05)
 +{
 +    int x = lerp(x1, x2, time); 
 +    int y = lerp(y1, y2, time);
 +    DrawSomething(x, y);
 +    Delay(1);
 +}
 </code> </code>
functions/lerp.1489589401.txt.gz · Last modified: 2017/03/15 16:50 by korshun