http://www.kirupaforum.com/entries/ilyas.htm

I can’t work out how it was done… suggestions anyone?

http://www.kirupaforum.com/entries/ilyas.htm

I can’t work out how it was done… suggestions anyone?

Simple. The person simply had a bit too much free time. There are 3 MC’s, “P” “O” and “M”. each one had many little square MC’s in it. On a rollover of one of the major MC’s, it would play all the minor MC’s, which were flipped and moved using a little something called time.

If you want the actionscript, it would be something like this (for the 1st frame of the swf)

```
p.on (rollOver) {
s1.gotoAndPlay (2)
s2.gotoAndPlay (2)
s3.gotoAndPlay (2)
```

and so on. Each minor mc would have “stop()” in the first frame and “gotoAndStop(1)” in the last. They would also make sure to have a keyframe in the second frame.

The “pixels” are not pre animated. It animated using actionscript (You’d see this if you noticed that they moved to different places everytime).

Most likely how its built:

The sperate “pixels” are grouped into one movieclip most likely, and then when the mouse moves while overtop the clip all the little movieclips are given random velocity within a range of three or four as well as a random angle. They slow down due to a “frictional” force and once they attain a low velocity (the velocity will never atucally equal zero) veolcity they wait for a set amount of time before springing back into place. Bit-101’s Spring/Elasticity Tutorial For the pixels to move along the angle with the random velocity the actionscript would look something like this:

```
v = Math.random()*4+10; //random velocity between 10 and 12
fric = .98; //friction to cause deceleration
damp = .98; //damper for the spring
k = .2; //spring constant
angle = Math.random()*360; //random angle
tx = 100; //original x position of clip
ty = 100; //original y position of clip
//onEnterFrame actions
if(this.count < 15) {
this.v *= fric;
this._x += Math.cos(angle*Math.PI/180)*v; //I always get the sin and cos mixed up so expreiment a little
this._y -= Math.sin(angle*Math.PI/180)*v; //see abvoe
if(this.v < 1) {
this.v = 0;
this.count++;
}
} else {
this.ax = (tx-this._x);
this.ay = (ty-this._y);
this.ax *= k;
this.ay *= k;
this.vx += this.ax;
this.vy += this.ay;
this.vx *= damp;
this.vy *= damp;
this._x += this.vx;
this._y += this.vy;
}
```

That would probably work except for the scaling and flipping.

[edit]Edited range[/edit]

The flipping would be done easily by adding in _xscale and/or a _yscale factor:

```
v = Math.random()*4+10; //random velocity between 10 and 12
fric = .98; //friction to cause deceleration
damp = .98; //damper for the spring
k = .2; //spring constant
angle = Math.random()*360; //random angle
tx = 100; //original x position of clip
ty = 100; //original y position of clip
//onEnterFrame actions
if(this.count < 15) {
this.v *= fric;
this._xscale -= this.v; //you may want to use a variable to control whether this happens to one or the other
this._yscale -= this.v;
this._x += Math.cos(angle*Math.PI/180)*v; //I always get the sin and cos mixed up so expreiment a little
this._y -= Math.sin(angle*Math.PI/180)*v; //see abvoe
if(this.v < 1) {
this.v = 0;
this.count++;
}
} else {
this._xscale += (100-this._xscale)/20;
this._yscale += (100-this._yscale)/20;
this.ax = (tx-this._x);
this.ay = (ty-this._y);
this.ax *= k;
this.ay *= k;
this.vx += this.ax;
this.vy += this.ay;
this.vx *= damp;
this.vy *= damp;
this._x += this.vx;
this._y += this.vy;
}
```

Sorry, I must say, it all looks good, but the big problem with this is, im an AS n00b, but I am trying to understand this, but if anyone has enough time to explain this to me, i would be greatly appreciative… THANKS ALL

ignusb

:: Copyright KIRUPA 2024 //--