From the course: Processing: Interactive Data Visualization

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Working with easing

Working with easing - Processing Tutorial

From the course: Processing: Interactive Data Visualization

Start my 1-month free trial

Working with easing

One of the more interesting dynamic tricks that you can do in Processing is to have an object follow your mouse. Now, this is pretty easy to do, because when you specify, for instance, the center of an ellipse, instead of using X and Y, you can simply use the built-in Processing commands mouseX and mouseY. However, the problem with that, they end of following too quickly, and it doesn't seem natural. It's a little jerking in motion. Instead you can use an adaptation of this that's known as easing. Now, there's not a built-in function for easing. It's something you have to code, but it's a simple adaptation, and it allows things to gradually follow with some lag where the mouse, for instance, is going. And that's what I'm going to show you in this particular sketch. Put a comment in with the name. Then I'm going to bring it in a color palette from the palette text file. I'll use this one down here at the bottom. Then what I am going to do is I am going to do kind of an interesting…

Contents