PLEASE RELOAD
Rotate



Info

This script can be added to all other scripts; even the gradient scripts. in regular draw scripts it will allow you to rotate your drawn image or your entire canvas; and you may do this multiple times with both. When you rotate and continue to draw, you will always get a black draw line. Images drawn in rotate may later be filled, or stylebrushed or tiled.

Rotate Gradient

This will give you the 180 and 0 gradangles for your gradients. To do this we Rotate and Display the image. Lesson 9 covers making gradients.

Here are a couple of examples of gradients rotated 90 degrees.

Example Example2
Gradient annotated zip::
http://simplysally.com/GD/lessons/lesson12-gradrotate.zip


Image Rotate
The following will rotate your previously drawn image 45 degrees.


$rotate = imagerotate($im, 45, $bck);

You may then continue to draw images and if you again need to rotate, just insert the code again. Notice in this code $im is used, this refers to the image above the rotate function. The possibilities here are many. Experiment to see how many rotations you can do; or need to do.

Canvas Rotate
The following rotates your canvas.


$rotate2 = imagerotate($rotate, 45, $bck);
You may then continue to draw images and if you again need to rotate, just insert the code again.


$rotate3 = imagerotate($rotate2, 45, $bck);


Notice in this code $rotate is used, this means take the rotated shape and rotate it another 45 degrees. In the case of rotate3 we're taking the accumulated rotate to rotate again. Again the possibilities here are many. Experiment to see how many rotations you can do; or need to do.

Once you rotate your image 45 degrees the center point changes and placement can be difficult as you need to know the center point of the diagonal. The mathematical formula for this is a2+b2=c2 where a and b are the sides of your canvas. Square root tables can be found on line. Here are some center points for some common squares.

THE CENTER OF YOUR SQUARE CHANGES AFTER 45 DEGREE ROTATION...FOLLOW THIS CHART
CENTER OF 50X50=35
CENTER OF 100X100=70
CENTER OF 150X150=106
CENTER OF 200X200=141
CENTER OF 250X250=176
CENTER OF 300X300=212


Here is an example of an image rotated 45 degrees and then the canvas rotated 45 degrees:



This zip file contains the php script and the example script shown here, plus a text file of the php script....

http://simplysally.com/GD/lessons/lesson12.zip

Some script annotations by Pagemaster101

GD BasicsHome