FSOSS 2010/processing.js/transforms

From CDOT Wiki
Revision as of 23:15, 27 October 2010 by Asalga (talk | contribs)
Jump to: navigation, search

Transformations

  • Order is important!
  • Let's try to rotate a square in place
rotate(radians(45));
translate(width/2, height/2);
rect(0, 0, 20, 20); // rectangle moves off the canvas
  • When we translate, scale or rotate we change the coordinate system
translate(width/2, height/2);
rotate(radians(45));
rect(-10, -10, 20, 20);