question on lerp()
in
Programming Questions
•
1 year ago
a short (and most probably stupid) question
why is this not working when i assign the same t value on both left & right click like this
am i missing something?
- PVector center;
- PVector radius=new PVector(0, 0);
- float t;
- public void setup() {
- size(600, 600);
- smooth();
- center=new PVector(width/2, height/2);
- }
- public void draw() {
- background(50);
- noStroke();
- fill(255, 255, 0);
- if (mouseButton==LEFT) {
- t=0.1f;
- }if(mouseButton==RIGHT ){
- t=-0.2f;
- }
-
- radius.x=constrain(lerp(radius.x, 400, t),0,400);
- radius.y=constrain(lerp(radius.y, 400, t),0,400);
- ellipse(center.x, center.y, radius.x,radius.y);
- println(t+" "+lerp(radius.x, 400, t));
- }
why is this not working when i assign the same t value on both left & right click like this
- if (mouseButton==LEFT) {
- t=0.1f;
- }if(mouseButton==RIGHT ){
- t=-0.1f;
- }
am i missing something?
1