Loading

Plerp


processing
Since v1.0.0
Available on all platforms
See also

Calculates a number between two numbers at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is half-way in between, etc. The lerp function is convenient for creating motion along a straight path and for drawing dotted lines, or any linear interpolation.

Link to original Processing doc

Signature

Examples

// @preview image 100 100 '2D3' PGraphics 255 Pbackground 15 'x1' STORE 10 'y1' STORE 80 'x2' STORE 90 'y2' STORE 2 PstrokeWeight $x1 $y1 $x2 $y2 Pline 0 10 <% 'i' STORE $x1 $x2 $i 10.0 / Plerp 10 + 'x' STORE $y1 $y2 $i 10.0 / Plerp 'y' STORE $x $y Ppoint %> FOR Pencode