Flash Vista - Home
Newest Cool Site
The Two Tales
Site info | Archive
Main Navigation
Home
New Links
Top Rated
Most Popular
Cool Sites
Search

Flash Tutorials
Flash Resources
Flash News
Flash Templates
Flash Intro Templates
Website Templates
Flash Games
Flash Books
FlashVista Polls
Sitemap


Random Link
English
Claudia Lareu
Site info | Get another
FlashVista
Login
Register
Subscribe

Add Link
Modify Link
Favorites
Suggest Category

Advertise with us
Support us
Credits / Thanks
Contact

Flash Templates:

More Templates ...

Mailing List
User

Password



Register
Forgot password?
Partner websites
iPhone cases and accessories
Free Seo Tools
Free Tutorials
Free Video Tutorials
Best Free Scripts
Wii Fit
Wii Fit News
Other Resources
Suggest
Suggest this site to a friend


Mailing List
Status: Not logged in

English English German French Spanish Italian Portuguese Russian Polish Finnish Dutch Swedish Thai Romanian Traditional Chinese Simplified Chinese
SearchNot logged in
Keyword: Search for: Advanced Search


Flash 3D Rotation and Revaluation


NEW Flash Tutorials in Video Format - Powered by LearnFlash.com: 45 minutes of flash tutorials now available in streaming format or download. Topics Include flash for beginners, text effects, actionscripting, audio/video, flash 8 and more.


Download the source file for this tutorial Printer version



By Nitin Tikhe






Basic Concepts about 3D :

In three dimensions, Width is left to right i.e. along X- Axis, height is top to bottom i.e. along Y-Axis and depth is close to far i.e. along Z-Axis. The computer screen can show you only two dimensions - width and height. We can not see the depth on screen.

What is Depth : When objects get further away they get smaller and smaller and hen the objects come closer they get larger and larger in size. We can create such effects in Flash.

On computers :
Height is represented by Y-Axis.
Width is represented by X-Axis.
Depth is represented by Z-Axis.



Since Flash is a 2D program, it doesn't have a z property, but we can create one.
Rotation: There are three ways to rotate an object.

  1. Z-axis rotation rotates an object around the z-axis.


  2. Y-axis rotation is around the y-axis.


  3. X-axis rotation is around the x-axis




Flash supports z-rotation for objects through the _rotation property. But this is just normal rotation. So, how much to scale it to get a realistic?

It depends upon the art of the programme so as to give an effect of solidity and relative position. This is also known as perspective.

First we need to set a value which is the distance from the viewpoint to the screen. How much you make this value will determine how much perspective things have - how fast they will grow or shrink as they move toward or away from you. We'll set it at 150 for now.

Per=150;

Next we need a scale value. This will be based on the Per and Z.

The formula is:
scale= Per /(Per + z value);

We can then use this to compute an _xscale and _yscale for our object:

_xscale= _yscale = scale* Any Number;


Now we start our tutorial.

A) Ball Revaluation :

Follow the steps.

  1. Open new Flash movie.
  2. Dimensions : Height – 550, Width – 400
  3. Background color – Light Blue
  4. Frame rate – 100 To 120.
  5. Press Insert then press New Symbol.
  6. Select Movie clip behavior.
  7. Name the Movie Clip. I have selected Symbol 1.
  8. Choose Oval Tool. No Stroke color.
  9. Draw a Circle with the dimensions – 40X40.
  10. Fill the Circle with any color, but it should be with gradient.
  11. See below the color I used.


  12. Enter Key frame at 10.
  13. Change the color gradient as shown below.



  14. Select 1st frame then go for Shape Tween.
  15. Press Enter and check Shape Tweening i.e. check blue spot travels from right to left.


This is about Ball Rotation.

B) 3D Ball Rotation :

  1. Go back to Main Time Line.
  2. Open library.
  3. Drag the copy of Movie Clip just you have created.
  4. Click the Movie Clip and enter the following code or just copy and paste.

(Check Export Mode).

onClipEvent (load) {
y=100;
Angle_Inc=12;
speed=1.5;
radius=200;
xcenter=100;
ycenter=40;
zcenter=100;
Per=150;
angle=0;
}

onClipEvent (enterFrame) {
x=Math.cos(angle*Math.PI/180)*radius+xcenter;
z=Math.sin(angle*Math.PI/180)*radius+zcenter;
scale=Per/(Per+z);
_x=x*scale+xcenter;
_y=y*scale+ycenter;
_xscale=_yscale=scale*50;

duplicateMovieClip (this, "ball"+0.1, angle/Angle_Inc);

angle +=speed;
if(angle>359){
angle -= 360;
}
}


Code explanation: I am not going to explain every line but some of them.

  1. Angle_Inc = 12;
    Symbol will be duplicated at every 12 degrees i.e. you will see 30 symbols/objects on the screen (360/12=30).

    If Angle_Inc = 15;

    Symbol will be duplicated at every 15 degrees i.e. you will see 24 symbols/objects on the screen (360/15=24) and so on.

    Change value of Angle_Inc and the number of symbols/objects will appear on the screen accordingly.

  2. duplicateMovieClip (this, "ball"+0.1, angle/Angle_Inc);

    The standard form of duplicateMovieClip is :

    duplicate movie clip (target, new name, depth)

    where target is the name of the movie clip.

    Here I used this which refers to the current object.

    Declaring a variable in an onClipEvent(enterFrame) made the variable relative to the clip.

    new name : is the unique identifier of the movie clip.

    depth is the stacking order of the duplicate movie clip.

    Here I used angle/Angle_Inc as a depth. This is explained in above Code.


Play around with different values of Y and angle/Angle_Inc.

Also try with Candle Flame.

Pl forward me any suggestion or correction.

My mail ID is : nitin.tikhe@tatamotors.com


(Added: 04-28-2006, Hits: 0, Rating: 3.66, Votes: 480, Reviews: 16)
Add to Favorites Suggest to a Friend

Reviews: (10)

i've noticed something wrong with your flash program, if you look at the balls on the left they depth is wrong.
(Added: 03-06-2007 User: Guest)

i will try it...i hope its work. mm..nice aa...anyway, thanks a lot
(Added: 02-28-2007 User: Guest)

nice tut!
(Added: 02-10-2007 User: Guest)

cool, is it possible to add shadows
(Added: 01-13-2007 User: Guest)

Superb
(Added: 12-19-2006 User: Guest)

its good and working

bhupendra singh
Meerut

(Added: 12-18-2006 User: Guest)

why does one eyeball dissapear on the right side of the screen?
bunk!

(Added: 12-01-2006 User: Guest)

nice effect. wish that i can have more
(Added: 11-04-2006 User: Guest)

I think it's good. It's strightforward, and easy and simple to read and use. Although, I didn't think it elaborated enough on a few things such as where to type the coding, but other than that I like it.
(Added: 10-18-2006 User: Guest)

This is an almost direct ripoff from Keith Peters.
At least give him credit

(Added: 10-09-2006 User: Guest)


Add Review
Please note:
We review EVERY comment before it appears on the site, so please dont waste your time by posting spam links :)
No URLs allowed, no HTML please.

If you register or login first, your review will contain your nickname


Rate It



Excellent!
Very Good
Good
Fair
Poor