Matrix
Matrix
Since the Matrix font is uncommon; we need to embed it into the Flash Movie. Select the
Text Box and click Embed...
We only need the lowercase letters.
Now go back to the text properties and give it an instance name "Neo".
Double Click the Movieclip on Stage. Select frame 10 and insert a keyframe:
Insert > Timeline > Keyframe (F6)
Now insert an additional keyframe at 20.
Click frame 10 again, select the MovieClip on Stage and change the Color to "Tint" with
the following settings:
With the MovieClip still selected, open the Transform Pane and increase it the scale to
125%. This will make the pulse buldge with energy as it travels up the line of code.
Now the tweening white pulse. Click in between frame 1 and 10:
In the properties pane, select "Motion" under Tween and set Easing to 100.
This will gradually slow the pulse as it reaches the brightest point.
Click between frame 10 and 20, set Tween: Motion, easing -100 IN.
One last important thing, Click Frame 1 and open the ActionScript window
Window > Actions
Enter the single command "stop();".
We are done setting up the Movieclip, click "Scene 1" to return to the Main Timeline.
Click the MovieClip on Stage and Delete it. Don't worry, it remains in our library ready
to be referenced by the Linkage Identifier "one_pod".
// ---------------------------------------------
// The Flash Matrix - www.pixelhivedesign.com
// ---------------------------------------------
// Initialize variables.
maxLines = 25; // Maximum number of lines at once.
minScale = 10; // Minimum scale of a line.
maxScale = 100; // Maximum scale of a line.
// Create an empty Movieclip to hold the Matrix.
theMatrix = createEmptyMovieClip('MatrixCode',1);
curLines = 0; // Keeps track of the current number of
lines.
// ----------------------
// Generating the Matrix.
// ----------------------
theMatrix.onEnterFrame = function(){
// Check that the current number of lines is less than
the maximum allowed.
if(curLines <= maxLines){
curLines++; // Increment the number of lines.
// Create a new line.
codeLine =
this.createEmptyMovieClip('codeLine',curLines);
// Generate a random scale for the line.
// This simulates lines at different distances.
var ranScale = Math.round(Math.random() * (maxScale-
minScale)) + minScale;
codeLine._xscale = codeLine._yscale = ranScale;
// Position the line at a random X location.
codeLine._x = Math.random() * Stage.width;
// Determine line speed based on the distance.
codeLine.speed = (codeLine._xscale)/10;
// ---------------------------------------------
// Creating a line of multiple pods (characters)
// ---------------------------------------------
codeLine.myCodes = []; // Array to store individual
pods.
numPods = 0; // Number of pods.
while(codeLine._height < Stage.height){
numPods++; // Increment the number of pods.
// Attach a single pod to the line of code.
pod =
codeLine.attachMovie('one_pod','pod'+numPods,numPods);
codeLine.myCodes.push(pod); // store pod.
// Position pod above the last one (vertical lines)
pod._y -= (pod._height+2) * numPods;
// Choose a random Matrix character.
// Character Codes for lower case letters are between
96 & 123
pod.the_one.Neo.text = chr(Math.round(Math.random() *
27) + 96);
}
// ----------------------------
// Initialize the white pulse.
// ----------------------------
// Store pod position to start at.
codeLine.ind = 0;
// Store delay between pulses.
codeLine.delay = codeLines.myCodes.length;
// ------------------------------------
// Animating each line of code.
// ------------------------------------
codeLine.onEnterFrame = function(){
// -------------------------------
// Vertical animation of the line.
// -------------------------------
// Every frame make the line move down by it's speed.
this._y += this.speed;
// Check if the line of code has animated off the Stage
if(this._y - this._height >= Stage.height) {
// Yes, so allow an additional line to be generated.
maxLines++;
// Remove this line and free memory.
this.removeMovieClip();
}
// ----------------------------
// Animating the white pulse.
// ----------------------------
// Get next pod to affect.
this.curCode = this.myCodes[this.ind];
// If the pod is not currently animating, start its
animation.
if(this.curCode._currentframe == 1)
this.curCode.play();
// Check if we have reached the end of the line.
if(this.ind < this.myCodes.length and this.delay != 0){
// No, then move on to next character.
this.ind++;
// Decrease the delay before next pulse.
this.delay--;
} else {
// Yes, then reset the character position.
this.ind = 0;
// Reset the delay before next pulse.
this.delay = this.myCodes.length;
}
}
}
}
Neonnnnnnnnnn
Step 1 : Document Setup
Open Adobe Flash and Modify the Document Properties.
Modify > Document
Size: 390 x 250 (Size of my example graphics)
Frame Rate: 30 fps
Background: White
With the image selected use the Align Pane to position it on Stage. Make sure the "To
Stage" button is down, then click the two align options below:
Window > Align
Select Frame 1, labeled "Actionscript", on the Timeline inside the Movieclip you want to
flicker and open the ActionScript Window.
Window > Actions
1. // -------------------------------
2. // Flickering MovieClip Effect
3. // www.pixelhivedesign.com
4. // -------------------------------
5. // All time in milliseconds. (1000 = 1 second)
6. maxTB = 4000; // Maximum time between flickering
7. minTB = 1000; // Minimum time between flickering
8. flickerDuration = 2000; // How long flicker will last
9.
10. // Get a random start time.
11. flickerTime = getNewTime();
12.
13. // Every frame execute the following code.
14. this.onEnterFrame = function(){
15. // Get current time in milliseconds.
16. curTime = getTimer();
17.
18. // Check if current time is past the time to
flicker.
19. if(curTime >= flickerTime){
20. // Flickering.
21. // Check if flicker has lasted the duration
specified.
22. if(curTime <= flickerTime+flickerDuration){
23. // Continue flickering.
24. // Alternate between alpha values.
25. // This creates the flicker appearance.
26. if( cnt >= 2){
27. // Reduce alpha.
28. // Lower this for more dramatic effect.
29. this._alpha = 90;
30. cnt = 0;
31. } else {
32. // Increase alpha.
33. this._alpha = 100;
34. cnt++;
35. }
36. } else {
37. // Flicker lasted for duration.
38. // Stop flickering and get next time to flicker.
39. this._alpha = 100;
40. flickerTime = getNewTime();
41. }
42. }
43. }
44. // Create a random time between maxTB and minTB
specified.
45. function getNewTime(){
46. return getTimer() + (Math.random() * (maxTB-
minTB))+minTB;
47. }