We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey all! I have created a rotating canvas, and trying to do a :
if(mouseIsPressed) {
graphics.fill(255)
graphics.stroke(255);
graphics.ellipse(mouseX, mouseY, 100);
}
but the mouse is not recognising the rotation and so I press the mouse and if its not in the center it won't recognize where on the canvas I am... HALP!
Answers
The
mouseX
andmouseY
variables hold the screen-based position of the cursor. After you do a rotation, your pixels are being drawn in model-based positions.You can try to project the mouse position into model space.
Depending on what you want to do, you could also modify your code so you do the rotations after you do the drawing, using an off-screen buffer. The
createGraphics()
function is your friend here.If you're still having trouble, please post a small example sketch that demonstrates the problem.
So this is what I have, the canvas is rotating but the drawing on top is not connected with that rotation so is drawing where the canvas sits at its static position
The code you posted is not inside a
draw()
function so I don't think it'll work at all.It's also cut off at the end?
my code is 270 lines long, I only put in the code I was trying to write to do the thing.
Cool, in that case please narrow the problem down to a small example sketch that demonstrates the problem. The idea is that we should be able to copy and paste your code to see the problem ourselves, but it shouldn't contain any extra code that's not related to the problem. See also: MCVE.
Awesome, Thanks, first time me asking questions on a code forum!
here is a demo of what you probably don't want, the drawing is on the rotating canvas by drawing in the upper left corner. It's also in classic processing.
new version, draw on the rotating canvas, NOT working
makes you feel dizzy....
is it easy to change this to p5? I tried with the voids and push's and pops but its still not working
It doesn‘t really work anyway
Just run it in classic processing mode