Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 1.23 KB

File metadata and controls

23 lines (20 loc) · 1.23 KB
featuredImage title oneLineDescription
../../../images/featured/06_Calculating_Values-00_Interpolate-thumbnail.png
Linear Interpolation
Convert a number between 0 and 1 to another range.

Interpolation calculates a value between two other values. For example, the number 5 is halfway between 0 and 10. Different types of interpolation use different rates of change between values. Linear interpolation, abbreviated as lerp, uses a constant rate of change. The lerp() function linearly interpolates between two numbers.

Move the mouse across the screen and the symbol will follow. Between drawing each frame of the animation, the ellipse moves part of the distance from its current position toward the cursor.

Contributors from the p5 community wrote this example. Soon their names will appear here. In the meantime, you can <a href="https://github.com/processing/p5.js-website/blame/d6b28924185dac5e25c39cd0fc2fc4a1f6392883/src/content/examples/en/06_Calculating_Values/00_Interpolate/code.js" target="_blank"

see their contributions in the source code.