PDA

View Full Version : [MX] Ilyas's Matrix Code Effect in a MovieClip



Keith130
July 22nd, 2003, 04:23 PM
I am trying to make a matrix code effect inside a movieclip called "Code", I am using the code made by Ilyas but have so far been unsucsessful, I can get it to work in the main root of a seperate .swf but not in the root of my main movie or a movieclip inside the root. I dont know how to alter it top make it work for a movieclip? Any suggestions? If you dont know the code I am talking about see below :



/***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 = "MEDIUM";

// String containing all the characters available in the font
letters_str = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx yz" ;
length_num = letters_str.length ;

// Create a new trail every 100 milliseconds
setInterval(this,"createTrail",10);

/*** 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 -= 3;
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 = "Font1";
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)/10)*10;
clip._y = clip.y = -10;
// Choose a random size for the letters, and set the spacing
var size = random(10)+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;
};
};

claudio
July 22nd, 2003, 04:39 PM
Make sure you give a linkage identifier to the font in the library.

Keith130
July 22nd, 2003, 04:50 PM
Ooops I had an i dentifyer before Trace Bitmaping my logo into the .swf and crashing my PC ,well it works now, thanks!

claudio
July 22nd, 2003, 04:56 PM
No problem :)

lostinbeta
July 22nd, 2003, 04:57 PM
That effect is too processor intensive for regular use, so if you are using it in a layout or something, I definitely don't recommend that.

Keith130
July 23rd, 2003, 04:28 AM
I agree Im only using it for a few seconds until the words "The Matrix" mask in. I am also using a setInterval of 150 so there arent that many trails on the screen at once.



This is probabily an insane question but is there anyway to recreate the Matrix Reloaded code effect at the beggining in AS or would that take hundreds of tweens?

pom
July 23rd, 2003, 12:28 PM
My advice: forget it!! :P

thoriphes
July 23rd, 2003, 01:27 PM
Originally posted by Keith130


This is probabily an insane question but is there anyway to recreate the Matrix Reloaded code effect at the beggining in AS or would that take hundreds of tweens?

yeah...i'm sure it can be done :whistle:

pom
July 24th, 2003, 06:54 AM
:bad:

Keith130
July 24th, 2003, 07:34 AM
What wrong with you Ilyas?

blah-de-blah
July 24th, 2003, 10:00 AM
whats the new matrix reloaded code effect like? isn't it similiar?

Keith130
July 24th, 2003, 10:18 AM
Yeh its similar exsept is code made of code made of code.....

It sort of zooms out from the smallest code to the one that is made of that code and so on.

pom
July 24th, 2003, 10:29 AM
Originally posted by Keith130
What wrong with you Ilyas? Nothing :P

Keith130
July 24th, 2003, 01:58 PM
What was the grr face thing for then?

lostinbeta
July 24th, 2003, 02:01 PM
I believe it was kind of an "i dare you" gesture.

Keith130
July 24th, 2003, 05:54 PM
Yeh that will be the day when I create some advanced actionscript I just marvel the how people know all the stuff they do and lamly try to make something I am happy with, no I will leave some Matrix Coding to someone who knows what they are doing.