Hype

github.com / HYPE_Processing
by Joshua Davis and James Cruz
for Processing and ProcessingJS

HYPE_processing, is a collection of classes that performs heavy lifting tasks while using a minimal amount of code writing.
<< back

Your browser does not support the canvas tag.

ex19_Bounds

HYPE, HRect, HRotate, HFollow, .bounds()

Source code
HRect boundingBox, r;

void setup() {
	size(640,640);
	H.init(this).background(#202020);
	smooth();

	H.add(r = new HRect(100).rounding(10))
		.noStroke()
		.fill(#0095a8)
		.anchorAt(H.CENTER)
		.locAt(H.CENTER)
	;

	H.add(boundingBox = new HRect().rounding(10))
		.strokeWeight(2)
		.stroke(#FF3300)
		.noFill()
	;

	new HRotate().target(r).speed(1);
	new HFollow().target(r);
}

void draw() {
	// `r.bounds()` will set the x & y fields of `loc` and `size`
	PVector loc = new PVector(), size = new PVector();
	r.bounds(loc,size);
	boundingBox.loc(loc.x,loc.y).size(size.x,size.y);

	H.drawStage();
}