Tutorial - Coordinates
You know about objects and how to use them now. Int previous topics we used coordinates to move objects using SetPos () methods. What do these coordinates mean? What is the movie size?
The default movie size is 800x600 pixels. You can change it by using SetMovieSize () function. For example if you want to make a high definition 1280x720 pixels movie you can do this using this instruction:
SetMovieSize ( 1280, 720 );
You should use this function only once in your script, preferably at the beginning. If you use this function more than one time, the latest size will be set.
The origin of your movie is in the center and has (0, 0) coordinates. Axis X points to the right. Axis Y points down. The default coordinates of the left upper corner are (-400, -300). The default coordinates of the right bottom corner are (400, 300). If you change your movie size to high definition resolution 1280x720 as described above then the left upper corner will be (-460, -360) and the right bottom corner will be (-460, -360).
There is another reason why coordinates can change. Web Cartoon Maker supports 2D camera which can be moved across your movie and zoom in and out. We do not want to give you details on camera yet. Just want to give you a simple example. If you use ChangeCameraZoom () function to zoom out like this:
ChangeCameraZoom ( 0.5, 1 );
then the default coordinates of movie corners will be (-800,-600) and (800,600).
Here is what you can try after reading this. We have a special image in our library which can show you the coordinates. We never used Image objects yet, but it is really simple:
- Copy and paste the following script to Web Cartoon Maker:
void Scene1 ()
{
Image Back ( "wcm/coordinates.emf" );
Back.SetVisible ();
}
- Compile it and preview in WCM player to view the default movie coordinates
- Move mouse over the WCM Player window. Current movie coordinates will be displayed as a tooltip near the mouse
- Delete the script and copy and paste another one:
void Scene1 ()
{
// setup a background
Image Back ( "wcm/coordinates.emf" );
Back.SetPos ( 0, 0 );
Back.SetVisible ();
// wait
Sleep ( 1 );
// zoom in
ChangeCameraZoom ( 0.5, 1 );
// wait
Sleep ( 1 );
}
- Compile your new script, preview in WCM Player and note how camera zooming can change the coordinates
|