P5 | Feng Yifei | Observable
Comments (1)
AbserAri
Mar 16, 2021
WebGL mouseX and Y should call translate(-width/2,-height/2,0) to locate coordinate. function setup() { createCanvas(100, 100,this.WEBGL); } function draw() { translate(-width/2,-height/2,0); if (mouseIsPressed) { fill(0); } else { fill(255); } ellipse(mouseX, mouseY, 80,80); } ==== function setup() { createCanvas(100, 100); } function draw() { if (mouseIsPressed) { fill(0); } else { fill(255); } ellipse(mouseX, mouseY, 80,80); }
Reply
Add comment
Subscribe to notifications
Observable
Sign in
Feng Yifei
0
Reply
Add comment
Subscribe to notifications
0
P5 | Feng Yifei | Observable