I’m aware of how to make certain features move using integers and increments but is there a tool to animate/morph from one position to the other ie if I draw an object at 30 degrees at position 200,300 - then the same object rotated at 60 degrees at position 200,400 - can it morph between the two to animate?
Did you look at lerp()? It’s pretty cool.
You would not use a for loop but the fact that draw() loops.
Increment the amt parameter slowly.
Use lerp for x for y and for angle
See reference
Okay, will take a look. Thanks.
float amt=0;
void setup() {
size(1960, 1000);
background(0);
delay(12);
fill(255);
noStroke();
//
}//func
void draw() {
//
background(0); // clear screen
float x=lerp( 133, 1300, amt );
float y=lerp( 122, 900, amt );
text("test for lerp(). ",
x, y);
amt += 0.00414;
if (amt>=1.0) {
// noLoop(); // reached target
amt=1;
}
//
}//func
Hi Chris,
Thanks I managed to use lerp to interpolate between facial expressions (ie happy to sad would be lerp between an arc (for the lips) with a certain length, width and fill radian to another). I also managed to connect a slider which controls the level of interpolation (how happy or sad you want it to be). While this works for an interpolation between 2 states, my question is regarding how to do multiple states simulatenously? I want to have multiple sliders which allow a combination of interpolations. ie sliders for happy to sad, happy to angry, happy to disgust and you can be on 40% sad, 60% angry, 80% disgust and the lips adjust to interpolate a combination of the three interpolations. Appreciate your help/support!
This post is also continued here:
:)
Hey guys, I’m using lerp to interpolate between facial expressions (ie happy to sad would be lerp between an arc (for the lips) with a certain length, width and fill radian to another). I also managed to connect a slider which controls the level of interpolation (how happy or sad you want it to be). While this works for an interpolation between 2 states, my question is regarding how to do multiple states simulatenously? I want to have multiple sliders which allow a combination of interpolations. ie sliders for happy to sad, happy to angry, happy to disgust and you can be on 40% sad, 60% angry, 80% disgust and the lips adjust to interpolate a combination of the three interpolations.
You asked a similar question here:
Check out list-based interpolations
…and a related discussion using PVector