Re: JSUI-MGraphics patch-a-day


Forums > Javascript > JSUI-MGraphics patch-a-day
November 13, 2011 | 8:22 pm

Here is the patch for November 13, 2011:

In this patch, we are going to investigate what happens when we use the translate function to change the drawing location within mgraphics. You select different menu options to see what happens when you shift the location around. The last menu entry uses the translate function to draw the oscillator in the middle of the box.

When you use the translate function, you are moving "user space" around. After drawing/rendering is complete, the drawing is clipped to the display area. So, translate calls in a positive direction move the origin (0,0) to the right and down, while translate calls in a negative direction move the origin up and to the left.

Working with translate() provides a lot of functionality in placing and altering our draw routines.

Enjoy!