So - making a “Star Wars” text crawl (because, yes, I’m that kind of a dork)… I realized I can’t do it the easy way.
We have translate, rotate, and scale - but no skew (or distort). Skew would make all sorts of pseudo-3D stuff much easier.
If you’re in safari (even mobile safari!) - check it out http://www.gesteves.com/experiments/starwars.html (if you have a really new version of chrome, but not TOO new, it may work as well)
Either that or a matrix transformation, but those are seriously scary.
Meh - he used a “perspective” cheat.
What I really want is to transform a square into a trapezoid. I mean - I can (and will!) do it mathematically. I’d just rather have a transform take care of it for me.
We can add shearX and shearY functions that mirror processing’s. We might as well throw in applyMatrix() and overload rotate() to do axis-angle rotations.
translate() already accepts a z parameter, it’s just not documented.
The more you emulate of processing’s API, the more I can steal from their example code. RAWR!
Actually I just looked and you can call rotate as follows:
rotate( angle, x, y, z )
Where x, y, z are the axis to rotate around. I forgot I implemented this. (And it’s not documented on purpose.)
!!! Neat! I have something to mess with tomorrow then!
(I had suspected that this might have been floating around in there - you’ve mentioned the graphics API is modeled after processing, so to have it missing was odd)