ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


new:math

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
new:math [2019/04/20 19:15]
korshun
new:math [2019/04/21 01:25] (current)
korshun [Other useful functions]
Line 48: Line 48:
 // wrap around // wrap around
 selected_item = mod(selected_item,​ NUM_MENU_ITEMS);​ selected_item = mod(selected_item,​ NUM_MENU_ITEMS);​
-</​code>​ 
- 
-=== lerp === 
- 
-''​fixed lerp(fixed a, fixed b, fixed alpha)''​ 
- 
-Performs [[wp>​Linear interpolation|linear interpolation]] (or extrapolation) between two numbers and returns the result. 
- 
-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>​
  
new/math.txt ยท Last modified: 2019/04/21 01:25 by korshun