Grip / draw()
import compose.grips.*; GripDispatcher dispatch; CircleGrip myGrip; void setup() { dispatch = new GripDispatcher(this); myGrip = new CircleGrip(50, 50, 40); } void draw() { dispatch.update(); // Checks for hover dispatch.draw(); // Calls all the draw methods } 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); } else { fill(255); } ellipse(x, y, diameter, diameter); } }- Description
Contains directions for drawing. All of the draw methods of every Grip are called by GripDispatcher :: draw().
- Syntax
class FancyGrip extends Grip { void draw() { statements } }- Parameters
- None
- Returns
- None
- Usage
- Web & Applications
- Related
Wed, 03 Mar 10 15:18:05 -0800 #
dadfsadfs