We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I think I can use mouseWheel() but need help getting started.
Also, first time here. I was wondering if topics here is mostly processing/java or p5js.
Answers
There is more java posts than p5.js but you can certainly ask any question about either of them.
Did you check the reference: https://p5js.org/reference/#/p5/mouseWheel
Kf
@banana --
Depending on what you are trying to do, you might approach zooming by:
translate(width/2, height/2)
scale(zoom)
to set the zoom level, with 1.0 being normal.This approach works the same in both p5.js and Processing(Java). Here is a simple example of a zooming sketch in p5.js -- it is almost identical to the Processing(Java) equivalent. There is no user input -- it just keeps zooming every time the screen redraws:
...and here is a slightly more complex setup in which
mouseWheel()
controls the zoom variable:For more, see:
If you are trying to do other kinds of zooming, such as zooming on whatever the current mouse location is, then the basics are the same but it gets a bit more complex. See: