Learn sophisticated
animation techniques including how to duplicate Movie Clips such that you can
create realistic animated trails that diminish in size and fade away as the
electron revolves about an atom's nucleus.
Background:
I saw the animation shown below a loooong time ago and was instantly smitten
with it, despite having no idea how it was made. Now, 18 months after learning
Flash, I happened upon it again and decided to see if I could make my own
version. My apologies to whomever I got this from originally; I can't seem
to find the animation again on the sites that the links lead-to. Anyway, I
happened to zoom in very closely to the "electrons" of the original
version of the atom, and saw that there were smaller duplicates of the "electron" coming
out of the original "electron". Eureka! I had the answer: They were
duplicating movie clips!
Keep
in mind you will have to use your judgment and creative prowess to set
the sizes of your clips. Keep looking at the animations to check yourself.
Step One: Setting up the Movie
Open a new Movie: File > New
Open the Property Inspector: Window >
Properties (Ctrl F3)
In the Property Inspector set the Size: 550
x 400
Set the Frame Rate to: 48fps
Note: Do not set the background to black
yet as I personally think it is easier to work on white and set the background
to black at the end.
Step Two: Creating the Electron Movie Clip and the Rings
The Ellipse
Select the ellipse tool from the toolbar:
On the Main Stage draw an: Ellipse
Single click in the centre of the
ellipse: Delete Fill
If the Property Inspector is closed, open it: Window
> Properties(Ctrl F3)
Click on the stroke (outline) of
the ellipse and resize: 192
wide x 61 high
For Width select: Hairline
Select
the Eraser tool
Make a very small gap at the top:
Note the small gap at the top of the ellipse.
Return to the Selection tool:
Right click (Mac: Ctrl click) on
the ellipse and select: Convert to Symbol
For Name type: Electron Ring
For Behavior select: Movie Clip
For Registration select top centre:
Click: OK
Right Click on you new Movie Clip and select: Edit
Note: This will take you inside the Movie
Clip you just created. If the Edit Bar is closed, open it (Window> Toolbars > Edit
Bar) and you will see the name of the new
Movie Clip: Electron Ring
Create 2 extra layers by clicking on the Insert Layer button
in the Timeline: (or
Insert > Timeline > Layer)
Name the Layers as follows:
Names of Layers inside the symbol: Electron Ring
Right click (Mac: Ctrl click) on
the guide layer label select: Guide
Note the Guide Layer Icon changes:
Attach the Electron
Layer to the Guide Layer by dragging the Electron Layer just
under the guide layer.
The Guide Layer Icon has changed again:
Note: If you have not done this before it
can be very tricky. You barley need to move the electron Layer at all.
Just move it slightly up and
to the left. The Electron Layer will attach itself to the Guide Layer.
When you release the mouse after dragging the Electron layer, if the
Guide icon has changed and a dashed line appears beneath guide Layer
and Electron Layer is indented, then everything worked!
Now the ellipse that
you drew needs a copy in the: Guide Layer
Select the: Ellipse
Go to: Edit > Copy(Ctrl
C)
Select Frame 1 of the: Guide Layer
Go to: Edit > Place in Place (Ctrl
Shift V)
You should now see a black Keyframe (dot) in
frame 1 of the Guide Layer.
In the Timeline urn off the visibility of the Guide Layer:
Visibility of the Guide Layer has been turned off.
Select the Ellipse on the: Ring
Layer
In the Properties Inspector change the line to: Solid
Set the thickness to: 3
pixels
With the Ellipse still selected go to: Modify > Shape > Convert
Lines to Fills
Open the Color
Mixer Panel: Window > Design Panels > Color Mixer(Shift
F9)
Select a Green to Black transparent to Black transparent: Radial Gradient Fill
A radial fill with three colours.
1st colour is Green
90% Solid: R = 0, G = 255, B
= 0, Alpha
= 90%
2nd colour is: Black Transparent: R = 0, G = 0, B
= 0, Alpha
= 0%
2nd colour is: Black Transparent: R = 0, G = 0, B
= 0, Alpha
= 0%
Select the Fill Transform Tool:
Click on the: Ellipse
Drag the small circle in the centre so that it aligns front
edge of the Ellipse:
Central circle
is in line with the front edge of the Ellipse.
Pull the Square right out to the left side:
Square pulled right out to the left side.
Your Ellipse should end up looking similar to this.
Step Three: Making the Electron MC - The Circle
You should still be inside the Electron Ring Movie Clip and not
on the Main Stage.
Edit Bar shows that you are editing inside the Electron Ring MC.
Note: If you are not inside the Movie Clip
Open the Library (F11) and right click on the Electron Ring MC and select:
Edit
Select Frame 1 of the: Electron Layer
Select the Ellipse tool:
Draw a: Circle
Select the Selection tool:
In the Property Inspector change its size to: 15 x
15 pixels
Set the width of the Stroke (outline) to: 3 pixels
Change the stroke to: Yellow
Change the fill to Green so that it looks
something similar to this:
Double click in the centre of the circle to select both the
fill and stroke: Select Circle
Right Click (Mac: Ctrl click) on
select: Convert to Symbol
For Name type: Circle
For Behaviour select: Movie Clip
For Registration select centre:
Click: OK Making the Electron: The Polygon
Step Four: Making the Electron MC - The Polygon
You should still be inside the Electron Ring Movie Clip with
Frame 1 of the Electron layer selected.
Select the PolyStar tool:
Note: The PolyStar tool can be found if you click and hold the mouse button
on the Rectangle tool and drag to select the PolyStar tool from the pop-up
menu.
In the Property Inspector click the Options Button:
Set the Options similar to this:
PolyStar tool options.
Return to the Main Stage by clicking: OK
Near the circle draw a: Pentagon
Select the centre of the pentagon and: Delete the
Centre
Make the stroke: Green
In the Property Inspector set the size to: 25.6 x
24.4 (width x height)
Your pentagon should look similar to this:
Right click on the pentagon and select: Convert to Symbol
For Name type: Pentagon
For Behaviour select: Movie Clip
For Registration select: Centre
Click: OK
Step Five: Making the Electron MC - Combining
the Circle and the Pentagon
You should still be inside the Electron Ring Movie Clip with
Frame 1 of the Electron layer selected.
Drag the circle on top of the Pentagon like this:
Select both the shapes: Circle and Pentagon
Right click and select: Convert to Symbol
For Name type: Electron
For Behaviour select: Movie Clip
For Registration select Centre
Click: OK
If the Property Inspector is closed, open it: Window
> Properties (Ctrl F3)
Give the new Electron MC an Instance Name: myElectron
Instance Name: myElectron
Step Six: Making the Electron MC - Animating the Electron
You should still be inside the Electron Ring Movie Clip.
On Frame 70 Shift click to highlight all: Three layers
All three Layers are selected on frame 70.
Right click in one of the blue Frames and select: Insert
Frame
The Layer now run all the way to frame 70.
Right click on Frame 1 of the Electron
Layer and select: Create Motion Tween
Right click on Frame 35 of the Electron
Layer and select: Insert Keyframe
Do the same for Frame 70 of the Electron
Layer and
select: Insert Keyframe
Your Timeline should look similar to this.
If visibility on the Guide Layer is off turn
it on: Show Layer
Turn off the visibility of the Ring Layer:
Lock the Guide Layer:
Visibility of the Ring Layer is off and the other are visible.Guide
Layer is locked.
Select Frame 1 of the: Electron
Layer
Grab the Centre of your Electron MC and snap in it on to the
Guide Ellipse just to the: Left of the gap
Electron MC snapped onto the left of the ellipse gap.
Note: As long as you drag he Electron MC
from its centre point you should see it jump or snap onto the elliptical
guide line as get close. If this does not happen make sure you
are dragging the Electron MC from the cross right in the centre of the
Movie Clip. If you still have problems try changing your Snap Options: View > Snapping
Open the Transform Panel: Window > Design Panels >
Transform
Change the size of the Electron MC to: 15%
Note: After typing the size you need to press
Enter to activate the new size.
In the Property Inspector set the transparency level to: Color
>Alpha
> 20%
Select Frame 35 of the: Electron
Layer
Snap the Electron MC onto the ellipse guide at the: Bottom
Centre
In Frame 21 the MC is snapped to the bottom centre.
Rotate the Electron MC: 180°
Select Frame 70 of the: Electron
Layer
Snap your Electron MC just to the: Right of the gap.
In the Property Inspector set the transparency level to: Color >Alpha > 20%
Change the size of the Electron MC to: 15%
Turn the Visibility of your guide Layer off:
Turn the visibility of your Ring Layer: On
Press Enter on your Keyboard to see the animation: Enter
Your animation should look like this.
Note: If it does not like this it is
probably because the Electron is not snapped to the guide correctly or
is not snapped to the correct position of the guide.
Return to the Main Stage by clicking on the Scene 1 Tab:
Save the Flash Movie.
Select the Electron Ring MC and press: Delete
Note: the Electronic Ring will still be in the Library.
Step Seven: Creating the Atom
Go to: Insert > New Symbol
For name type: Atom Altogether
For Behavior select: Movie Clip
Click: OK
Rename your only layer to: Rings
If the Library is closed, open it: Window > Library(F11)
Drag on to Stage the Movie Clip: Electron
Ring
Centre the Electron Ring MC on the Stage: Centre
In the Property Inspector give the Electron Ring MC
an Instance Name: myRing1
Drag another copy of the MC Electron Ring
onto the stage and name it: myRing2
Drag another copy of the MC Electron Ring
onto the stage and name it: myRing2
Rotate and Centre myRing2
and myRing3 until they look like
this:
Position of Rings on Stage.
Note: Do not type myRing1 etc on Stage (as
above) type the
Instance Names in the Property Inspector!
Use the Insert Layer button in
the Timeline to create another: Layer
Name the New Layer: Nucleus Spinners
Create another: Layer
Name the New Layer: Nucleus
Drag your Layers so that the order is like this:
Ring Layer is on the top.
On the Nucleus Layer draw a: Circle
Position and size it so that it fits neatly inside of the
the rings: Resize and Move Circle
Fill the circle with the following gradient fill:
From left to right, for the Paint Buckets:
1: #00FF00 at 100% alpha
2: #000400 at 100% alpha
3: #36FE36 at 100% alpha
4: #025801 at 100% alpha
5: #012501 at 0% alpha
6: #000000 at 0% alpha
In the Timeline turn the Visibility of the Nucleus Layer off:
Step Eight: The Nucleus Spinners
You should still be inside the Atom
Altogether MC.
Lock the Rings Layer:
On the Nucleus Spinners Layer draw a: Circle
Select the Stroke (outline) and press: Delete
Reselect the centre fill and size the circle: 40 x
40
Make a circular radial fill with the following properties:
From left to right, for the paint buckets:
1: #00FF00 at 100% alpha
2: #00E800 at 0% alpha
3: #00C000 at 0% alpha
4: #00E000 at 100% alpha
5: #007000 at 0% alpha
6: #000000 at 0% alpha
Right click on the Circle and select: Convert to Symbol
For Name type: Spinner
For Behavior select: Movie Clip
For Registration select: Bottom Left
Click: OK
Copy and Paste the Movie Clip twice so that you have
a total of: Three Instances
Move the Movie clips so that they are in a similar
position as below:
Nuclear Spinners in place.
Now we need to make them Spin !! To make sure they do not
spin in parallel we will need to rotate two of the spinners around.
If the Transform Panel is closed, open it: Window
> Design Panel > Transform (Ctrl T)
Select the: Top Left Spinner
In the Transform Panel for Rotation type: -120
Top let spinner rotated around.
Select the: Bottom Right Spinner
In the Transform Panel for Rotation type: 120
You should end up with something similar to this.
Select the: Top Right Spinner
Right Click and select: Edit
Select the circle that you drew earlier: Select Circle
Right click and select: Convert to Symbol
For Name type: Inner Glow
For Behavior select: Movie Clip
For Registration select: Bottom Left
Click: OK
Select the Free Transform Tool:
Move the Rotation Point from the centre
to the bottom left:
To
here ->
Move the rotation point from the Centre to the bottom left.
Return to the Selection tool:
In the Timeline select: Frame 1
In the Property Inspector select: Tween >Motion
Select Ease: 100
For Rotate select: CW x 2
Timeline properties for Frame 1.
In the Timeline right click on Frame 100 and
select: Insert keyframe
In the Property Inspector select Ease: -50
For Rotate select: CW x 2
Timeline Properties for Frame 100.
In the Timeline right click on Frame 200 and
select: Insert keyframe
On Frame 200 select the: Inner Glow
MC
If the Transform Panel is closed, open it: Window
> Design Panels > Transform (Ctrl T)
Set the size for both the width and height
to: 5%
In the Property Inspector set the color to: Alpha
0%
Go back to: Frame 100
Set the color to: Alpha 90%
Return to: Frame 1
Select the: Inner Glow MC
Set the size for both the width and height
to: 5%
In the Property Inspector set the color to: Alpha
0%
On your Keyboard press: Enter
You should see something similar to the above animation.
Return to the Main Stage by clicking on the Scene 1
Tab:
Go to: Modify > Document
Set the background to: Black
If the Library is closed, open it: Window Library (F11)
Drag the Atom Altogetheron
the: Stage
Test you Movie: Control > Test Movie (Ctrl
Enter)
You should see something similar
to this:
Step Nine: The ActionScript
The ActionScript achieves two things.
It rotates the Atom.
It creates the trails on the electrons.
We are almost done!
Now we need to add the Actionscript to the movie to make the electron trails!
Note: This ActionScript will not work
in Flash 5. See Details
Make sure you are on the Main Stage and not inside one of
the Movie Clips. If you are not sure click on the Scene 1 Tab to return to
the Main Stage:
Select the Movie Clip of the: Atom Altogether
In the Property Inspector give it an Instance Name: atom
In the Timeline select: Frame 1
If the Actions Panel is closed, open it: Window
> Actions(F9)
Place the following code in Frame 1.
// If you wish leave out the gray comments. /* Always stop the action unless there
is a reason to allow the playhead to continue to subsequent frames. */ stop();
// This function will cause the entire animation clip, named "atom" to
rotate by one degree each frame. _root.atom.onEnterFrame=function()
{ this._rotation +=
1;
}
/* We
need to stagger the initial starting frame of ring2
and ring3 to make sure no collisions of any electrons
occur! Since the total approx. number of frames in
the Electron Ring Movie Clip is 70, and I wish to
stagger the 3 named clips ring1, ring2 and ring3
equally, I set ring2 to start at 1/3rd of its total
animation loop, and ring3 to start at 2/3rd of its
total animation loop. */ _root.atom.myRing2.gotoAndPlay(Math.floor(70/3)); _root.atom.myRing3.gotoAndPlay(Math.floor(2*70/3));
//
using a 'for' loop that will execute 3 times, we... for (i=1; i<4;
i++) {
/* ... setup a dummy variable to be named
_root.atom.ring1, then _root.atom.ring2 and then _root.atom.ring3 so we may
later add an onEnterFrame function and then duplicate movie clips within
each ring1 ring2 and ring3 clip. */
sploosh = eval("_root.atom.myRing" +
i);
/* ... setup an onEnterFrame function to
duplicate the electron movie clip within each ring movie clip. I.e., due
to the dummy variable, "sploosh",
we will form 3 onEnterFrame functions, _root.atom.ring1.onEnterFrame, _root.atom.ring2.onEnterFrame
and _root.atom.ring3.onEnterFrame. */
sploosh.onEnterFrame = function()
{
/* Here, "this" refers to _root.atom.ring1,
_root.atom.ring2 or _root.atom.ring3 depending on which iteration of "i" we
are on currently. We duplicate the movie clip "myElectron" via the
this.myElectron statement, name each duplicated copy pent1, pent2, pent3, pent4,
pent5, etc. as "j" increments
every frame. */ duplicateMovieClip(this.myElectron,"pent" +
j, j);
/* Again, to deal with movie clip names programmatically
we use a dummy variable, "foosh". Here "this" refers to
_root.atom.ringX.pentY, where X is 1, 2 or 3, and Y is 0, 1, 2, 3... In other
words, each ring will inherit duplicate copies of "pent". Meaning
ring1 will have pent0, pent1 to pent? and ring2 & 3 will have pent0, pent1
to pent?. */
foosh = eval(this+".pent" +
j);
/* For each pent?, we define its own "onEnterFrame" function,
to make each pent do something as they animate alongside of the movie clip "electron" within
ring1, ring2 and ring3. */
foosh.onEnterFrame = function()
{
/* Each pent? will reduce in
scale in the x and y directions by 10%, every frame. */ this._xscale = this._yscale -=
10;
// Each pent? will reduce in alpha by 5%,
every frame. this._alpha -=
5;
/* If the alpha of any given pent? duplicate
drops below 36%, remove the clip to:
a) Remove it from the stage and ...
b) Simultaneously
remove each pent?'s onEnterFrame function.
To free up processing cycles, as
we don't need the pent?'s anymore. */ if (this._alpha < 36)
{ removeMovieClip(this);
}
// End foosh.onEnterFrame function
}
/* Finally, every frame, increment j by 1 so
that we can make more pent?'s and place them each on different levels within
the main movie. */
j += 1;
// End sploosh.onEnterFrame
function
}
// End 'for' loop
}
That's it!
Play with the scalar values that you decrease
the scale and alpha of each pent? clip, as well as when any given pent? clip
is removed. Or change the main movie's frame rate. Changing any of these values
will affect how the final Flash Movie looks.
Note: If you must include this clip in a Movie that is run at 12 or 24 frames-per-second,
rather than using onEnterFrame to duplicate movie clips and to decrease their
scale and alpha properties, consider using setinterval functions in tandem
with the updateAfterEvent() command. You can therefore gain a smoother animation
despite the slower frame rate. I haven't tried this out yet, but I shall sometime
soon.