JoshuaDavis icon

HCanvas reflection

JoshuaDavis | PRO | 05/03/21 02:16:01 PM UTC | 0 ⭐ | 433 👁️ | Never ⏰ | []
text |

790 B

|

None

|

0 👍

/

0 👎

import hype.*;
import hype.extended.behavior.HFollow;
 HFollow mf;
HRect   rect;
HCanvas canvas;
 int stageW = 640;
int stageH = 640;
 PImage canvasFlip;
 void settings() {
	size(stageW,stageH, P3D);
}
 void setup() {
	H.init(this).background(#242424).use3D(true);
 	canvas = new HCanvas(P3D).autoClear(false).fade(5);
	canvas.loc(stageW/2, 0);
	H.add(canvas);
 	rect = new HRect(100);
	rect.rounding(40).noStroke().fill(#ECECEC).loc(width/2,height/2).anchorAt(H.CENTER).rotation(45);
	canvas.add(rect);
 	mf = new HFollow().target(rect);
 	canvasFlip = canvas.graphics();
}
 void draw() {
	H.drawStage();
 	// flipped copy of HCanvas
	pushMatrix();
		scale(-1,1); // flip PImage on the x axis
		translate(-(stageW/2), 0, 0);
		image(canvasFlip, 0, 0);
	popMatrix();
 }
 

Comments