today tutorial is about 3D in Flash,(hover mouse on the swf )
First thing is You need Adobe Flash CS4/5 .because those are the versions support 3d features .In past this type of effect required a large amount of complicated Action Script to pull off.Here my objective is to introduce new 3D features in Flash cs4.
Ok,First open New Document File > new > Action Script 3.0
Now set doc size,I used 400px * 375px ,You can use your own doc size,But when writing Action script some changers may occur
Go to Rectangle tool and draw a rectangle
You can use any color or gradient , make sure it should cover whole Stage
right click and select convert to symbol.Type : Movie clip
give any name and double click it.Then again convert it to symbol again.(because to apply filters it should be movie clip or button).
now insert a key frame in 60th frame.
now go to 30th frame and insert another key frame .click on the clip and goto filters in property panel.
In filters select Adjust color and set hue to about 172 ,play with this
Now right click on time line and select classic Tween
do this to both side.
if you play the movie (Ctrl + Enter).see the FX . Longer key frame positions ,make smooth transition
Now ,the real coolest part
insert new layer and draw some circles with different colors and sizes.
Now turn them in to movie clips.And set their Z axis (use different values for each circle)
This step is very important.b coz the 3d effect is generate by this Z value(with out AS).Use different value.
Flash CS4 doesn’t have any actual camera controls like depth of field but we can fake it by adding some blur.
Select the movie clips and then twirl down the Filters section of the Property inspector.
Click on the Add Filter icon in the bottom-left of the panel and choose Blur.(add different blur values)
Now put them in one Movie clip(certainer).Select all circles(Ctrl + A) and go to Modify > convert to symbol(F8).
name it as circles_mc (can user any name ,but this will refer in AS)
Now Selection tool (V) and move the container movie clip around the Stage. see the fx
In action-script I do the same thing.Move the stage according to Mouse move
here the code.According to your stage size value should be change.
addEventListener(Event.ENTER_FRAME,loop);
function loop(e:Event):void
{
if(circles_mc.x<=-50 && circles_mc.x >=-400)
/*set the circle movie ’s postion according to the mouse position with slow motion effect change 0.01 value and see the FX */
circles_mc.x+=(mouseX-400) * 0.01;
circles_mc.y+=(mouseY-200) * 0.01;
{
if(circles_mc.x > -50)circles_mc.x=-50;
if(circles_mc.x < -400)circles_mc.x=-400;
if(circles_mc.y > -100)circles_mc.y=-100;
if(circles_mc.y < -300)circles_mc.y=-300;
}
}
This AS creates an enter frame event where the scene clip is continuously repositioned on the X-axis Y-axis based on the position of the mouse
And that s all Thanks , please comment
0 komentar:
Posting Komentar