Hey all,
I’m trying to create a matrx text effect for the background of a gallery. I found a great example from [font=Verdana][size=1][color=#99b3c1]ilyaslamasse (pom) aka ilyas usal, [/color][/size][/font]
and modified the actionscript to what i wanted. only problem: no matter what i try, it ends up using 100% of the CPU after mere seconds. as you can see, this would be a problem in the long-run.
for my first keyframe i have:
/***Author: Ilyas USAL (pom)
Title: The Matrix has you...
Date: 06/06/2003
Version: 2 -- Japanese characters, and it fades from white to green
***/
// To make it run smoother
_quality = "LOWEST";
// String containing all the characters available in the font
letters_str = "unrealtournament,;:!?./$" ;
length_num = letters_str.length ;
for the next layer and kayframe i have:
/*** Functions ***/
// fade out and remove clip when _alpha inferior to 10 - no parameters
function fadeToBlack(){
this._alpha -= 5;
if (this._alpha < 10){
delete this.onEnterFrame;
this.removeMovieClip();
}
};
// color fade from white to the original color
function whiteToGreen(){
this._alpha -= 5;
if (this.rb < 2 && this.gb < 2 && this.bb < 2){
this.rb = this.gb = this.bb = 0;
delete this.onEnterFrame;
}
else {
this.rb *= .9;
this.gb *= .9;
this.bb *= .9;
}
var trans = {rb:this.rb , gb:this.gb , bb:this.bb};
this.col.setTransform(trans);
};
// Create a new clip with a letter in it
// x: _x position ; y: _y position ; size: size of the letter
MovieClip.prototype.createLetter = function (x,y,size){
// Create and position the new clip
var mc = this.createEmptyMovieClip("letter"+this.dep,this.dep++);
mc._x = x;
mc._y = y;
// Create a new TextField in the clip
mc.createTextField("t",0,0,0,size,size);
// Choose a random letter
var myChar = letters_str.charAt(random(length_num));
mc.t.text = myChar;
// Create the TextFormat, format the text and embed the font
var tf = new TextFormat();
tf.size = size;
tf.font = "Katakana";
tf.selectable = false;
tf.color = "0x00ff00";
mc.t.setTextFormat(tf);
mc.t.embedFonts = true;
// Letter goes from white to green
mc.rb = mc.gb = mc.bb = 255;
mc.col = new Color (mc) ;
mc.col.setTransform({rb:255 , gb:255 , bb:255});
mc.onEnterFrame = whiteToGreen;
};
// Create a trail of letters
function createTrail(){
// Create new clip and position it randomly
var clip = this.createEmptyMovieClip("trail"+i,i++);
clip._x = Math.round(random(Stage.width)/20)*20;
clip._y = clip.y = -20;
// Choose a random size for the letters, and set the spacing
var size = random(20)+15;
clip.spacing = size ;
// onEnterFrame, create a new letter that will wade out.
// if we're at the bottom of the screen, fade out the whole trail
clip.onEnterFrame = function(){
this.y += this.spacing;
this.createLetter(0,this.y,size);
if (this.y > Stage.height) this.onEnterFrame = fadeToBlack;
};
};
and for the final layer and keyframe i have:
// Create a new trail every 100 milliseconds
setInterval(this,"createTrail",100);
here’s a sample i exported: matrix swf
any help?
[font=Arial][size=2]
[/size][/font]