Transformable DOM elements in GWT

In high school, any time I was bored in class I usually turned to programming my graphing calculator. I’m not sure what fancy compiler software they have now (TI doesn’t seem to be in a rush to update the hardware, at least), but back then, if you were programming on the calculator itself, you only had the built in BASIC variant at your disposal. As a result, I spent a lot of time figuring out things like the smallest rectangle I could clear every frame to keep the graphics up to date (And not learning Spanish. Oops).

As people tend to do, I eventually wanted to enter the 3d fray, probably spurred on by some terrible calculator Descent clone I had found on the internet (and programmed in…assembly? C?). I started with rotating a quad around either the (screen) x- or y-axes (which is just a scaling in either y or x). But when you did both, the “rotating” quad just looked like a shrinking rectangle…which, of course, it was. I asked my precalculus teacher if there was some kind of (dark) mathematics that could take a rectangle and calculate what kind of shape to draw on the screen after a rotation. That conversation seems preposterous to me now; that’s why we have an internet! This must have been 1998, and David and my website was definitely up, but I think back then, to me, the internet was for looking up things about the internet itself (and looking at when I was at the library, since they had an ISDN or something). (And yes, I realize I’m telling my “back in my day” story about 1998.)

Anyway, he didn’t know. 3d would have to wait until I discovered OpenGL and the exciting world of Winamp visualizations. If I had been my own math teacher I would have told myself to go back and figure out two dimensional rotations first, because if I could figure that out, 3d would be easy.

The point of this story—besides the fact that I have to tell it here since I’ll probably never find a person in real life who will listen to it (or read it? …)—is to serve as a clumsy segue into introducing a new gwt module for handling transforms. It will wrap Elements and the various draft implementations of transform and present a standard interface to the user. With Firefox’s -moz-transform finally letting it join Webkit and the surprisingly capable IE, the time seems ripe for this. IE does require some layout hatchet work for proper positioning, but part of this project will be developing methods of dealing with that so we can pretend most of the differences don’t exist. Some will remain, though; Webkit, for instance, has native matrix functionality built in, hopefully lending us decent performance in the mobile space.

The best part of this project, though, is that I get to base the software implementation on the first matrix class I ever wrote (homogeneous coordinates!). I’ve made some changes in the interim, but nothing’s better at bringing back memories than trying to figure out why the hell you unrolled a loop the way you did. Javascript should add another 10 years of wondering, easy.

This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">