Created
November 18, 2013 15:35
-
-
Save shiffman/7529804 to your computer and use it in GitHub Desktop.
Simple demonstration of lerp (as compared to average demo).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple interpolated value demonstration | |
// Daniel Shiffman | |
float lerpedMouseX; | |
void setup() { | |
size(300, 300); | |
} | |
void draw() { | |
background(0); | |
// The following moves lerpedMouseX "10%" of the way from itself to mouseX. | |
lerpedMouseX = lerp(lerpedMouseX,mouseX,0.1); | |
// Draw raw value and average to compare | |
ellipse(mouseX, 100, 32, 32); | |
ellipse(lerpedMouseX, 200, 32, 32); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment