I'm trying to track the position of an object so I can draw a trail behind it in p5.js
.
I'm moving the object around the screen with the translate()
and rotate()
functions, and in order to draw a trail I was going to store the object's position after each update in an array. I'm aware there was something like what I'm asking for in processing 3, the model X, Y and Z functions
, but as far as I can tell these haven't been implemented in the javascript version yet.
Even accessing the canvas's current transform matrix is proving problematic, and at this point I'm considering a redesign to omit the transform part of the api until this functionality is added.
So my question basically is: is there any way to determine the screen(canvas) coordinates of (0, 0) after applying a bunch of transforms?
I have a solution for this problem here:
https://github.com/ChristerNilsson/Transformer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With