Grip / isTheHover()
import compose.grips.*; GripDispatcher dispatch; CircleGrip c1, c2, c3; void setup() { dispatch = new GripDispatcher(this); c1 = new CircleGrip(25, 50, 40); c2 = new CircleGrip(50, 50, 40); c3 = new CircleGrip(75, 50, 40); } void draw() { background(200); dispatch.update(); dispatch.draw(); } class CircleGrip extends Grip { float x, y, diameter; CircleGrip(float x, float y, float diameter) { this.x = x; this.y = y; this.diameter = diameter; } boolean isHovering() { return dist(mouseX, mouseY, x, y) < diameter/2; } void draw() { if (this.isTheHover()) { fill(255, 0, 0, 230); // We are the BEST match (top most) } else if (this.isHovering()) { fill(255, 255, 0, 230); // Our hover conditions are satisfied } else { fill(255, 230); // We're not hovering } ellipse(x, y, diameter, diameter); } }- Description
True if this Grip is the best (top most) candidate for hover as determined by GripDispatcher. You cannot override this method.
- Syntax
class FancyGrip extends Grip { void anyMethod() { if (this.isTheHover()) { statements } } }- Parameters
- None
- Returns
- True if the best candidate for hover as determined by GripDispatcher
- Usage
- Web & Applications
- Related
No Comments
You must be logged in to post a comment.