Tutorial - Objects
You can use different kinds of objects in your movies. Currently Web Cartoon Maker supports the following objects:
- Text objects
- Image objects
- Characters
All these objects have some common methods to work with them. You already know how to define a text object:
void Scene1 ()
{
Text MyObject ( "Hello World" );
MyObject.SetVisible ();
...
}
We'll insert some code instead of the dots:
- SetVisible () - this method makes an object visible. You can also use it as SetVisible (false) to make your object invisible again. Here is how you can make an object invisible for one second:
MyObject.SetVisible ( false );
Sleep (1);
MyObject.SetVisible ();
- SetPos () and ChangePos () - these methods set and change the object position. Here is how you can move your object from one position to another smoothly during one second:
MyObject.SetPos ( 200, 200 );
MyObject.ChangePos ( 0, 0, 1 );
You can also use methods SetX (), ChangeX (), SetY () and ChangeY () like MyObject.ChangeX ( 200, 1 ) to smoothly change only individual coordinates
- SetAngle () and ChangeAngle () - these methods set and change the object angle in degrees. You can rotate you objects by using these methods. Here is how you can rotate your object smoothly during one second:
MyObject.SetAngle ( 360 );
MyObject.ChangeAngle (0, 1 );
- SetScale () and ChangeScale () - these methods scale your object to make it bigger or smaller. If the scale factor is bigger than 1 then you are going to make your object bigger. If the scale factor is less than 1 then your are going to make your object smaller. Negative values should not be used and may cause unpredictable results. Here is an example how you can make your object to grow during one second:
MyObject.SetScale ( 0 );
MyObject.ChangeScale ( 1, 1 );
You can also use methods SetXScale (), ChangeXScale (), SetYScale () and ChangeYScale like MyObject.ChangeXScale ( 2, 1 ) to smoothly scale only in one direction
- SetTransparency () and ChangeTransparency () - these methods can make your object fully or semi-transparent. You must supply a parameter between 0 and 1 to set a transparency level. If you supply 0 as a parameter, you make your object not transparent. If you supply 1 as a parameter you make your object fully transparent (invisible). Any value in between 0 and 1 will make your object semi-transparent. Negative values and values greater than 1 should not be used and may cause unpredictable results. Here is how you can make your object to appear smoothly out of "thin air" during one second:
MyObject.SetTransparency ( 1 );
MyObject.ChangeTransparency ( 0, 1 );
- SetMirror () - this method should be used with a boolean parameter true or false. If it is used as SetMirror ( true ) it will make your oblect to be shown mirrored. If it is used as SetMirror ( false ) it will make your object shown as usually again. Here is an example of how you can make your object mirrored for a second:
MyObject.SetMirror ( true );
Sleep (1);
MyObject.SetMirror ( false );
There are some other common methods available for all objects. Some of them can be used to determine current object parameters but we are going to learn about them later. Now lets compile all the above into a simple ready to use script. The text after double forward slashes (//) is a comment and does not change anything in your movie:
void Scene1 ()
{
// declare your object
Text MyObject ( "My Text" );
MyObject.SetVisible ();
// make it invisible for a second
MyObject.SetVisible ( false );
Sleep (1);
MyObject.SetVisible ();
// move it from one place to another
MyObject.SetPos ( 200, 200 );
MyObject.ChangePos ( 0, 0, 1 );
// rotate it
MyObject.SetAngle ( 360 );
MyObject.ChangeAngle (0, 1 );
// make object to grow
MyObject.SetScale ( 0 );
MyObject.ChangeScale ( 1, 1 );
// make object to appear out of thin air
MyObject.SetTransparency ( 1 );
MyObject.ChangeTransparency ( 0, 1 );
// make it mirrored for a second
MyObject.SetMirror ( true );
Sleep (1);
MyObject.SetMirror ( false );
}
Here is what you can try after reading this topic:
- Copy and paste the above script to Web Cartoon Maker
- Compile it
- Download your movie and open it in WCM Player
- Play the movie
|