How to manipulate Canvas elements: Difference between revisions

Jump to navigation Jump to search
Line 275: Line 275:
<syntaxhighlight>
<syntaxhighlight>
arrow.setTranslation(150, 80);
arrow.setTranslation(150, 80);
</syntaxhighlight>[[File:Translated.png|none|Translated arrow]]
</syntaxhighlight>[[File:Translated01.png|none|Translated arrow]]
The blue axis and labels are showing the <span style="background: white; color: blue">( '''u, v''' )</span> <big>absolute</big> coodinate system.<br />
The blue axis and labels are showing the <span style="background: white; color: blue">( '''u, v''' )</span> <big>absolute</big> coodinate system.<br />
Note that the translated arrow has brought with him his intrinsic coordenate system and his BoundingBox remains unchanged.<br />
Note that the translated arrow has brought with him his intrinsic coordenate system and his BoundingBox remains unchanged.<br />
Line 282: Line 282:
  <big>'''''u = T<sub>x</sub> + x'''''</big>
  <big>'''''u = T<sub>x</sub> + x'''''</big>
  <big>'''''v = T<sub>y</sub> + y'''''</big>
  <big>'''''v = T<sub>y</sub> + y'''''</big>
In a similar way, scaling works. Type:
<syntaxhighlight>
arrow.setTranslation(0,0);
arrow.setScale(1.5,2);
arrow.getScale();
</syntaxhighlight> you get ''[9.5,19.5, 120.5,40.5]'' which are the values for [Sx, Sy].<br />
Again, the BoundingBox and the intrinsic coordenate system remains unchanged.<br />
229

edits

Navigation menu