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.

Hovering and clicking

Hovering and clicking - Processing Tutorial

From the course: Processing: Interactive Data Visualization

Start my 1-month free trial

Hovering and clicking

Another very common form of interaction with the mouse is to hover over an object and have it change or to click on the object and have it change, and in this I want to show you how both of those are going to work in Processing. I'm going to start with a comment here, and then I am going to start by putting in a palette. Come back to my list of palettes here. I think I'll use this one, copy that, and paste it back where I was. And then I am going to create a few different variables that it will be using as part of the mouse interaction. What it is is I am going to be drawing two shapes. I'm giong to be drawing a circle and a square, and I am going to be changing the colors of them depending on whether we hover or click on them. So what I am going to do is create an integer variable here for the fill of the left shape, so left fill, lf. And that one is going to be the index number 2 in the palette. Then I am going to do a similar thing. I am just going to copy that and do the right…

Contents