HOME | DD

Published: 2006-11-24 05:28:42 +0000 UTC; Views: 9723; Favourites: 112; Downloads: 341
Redirect to original
Description
-NEEDS FLASH 8 OR HIGHER-Just a small experiment, that ended up quite hypnotic...
[MouseClick] - toggles blur
[LEFT, RIGHT, UP, DOWN] - controls gravity
[SPACE] - turns off gravity
[1] - snake mode
[2] - lines mode
Trip.
Peace.
***Check out the variation inspired by this work (which is even better imo) -> [link]
[EDIT March, 18. 2007.]
Since several people asked me about the code behind this, here's the basic engine for you to experiment with:
var numPoints = 20;
var speed = 10;
var stageWidth = 550;
var stageHeight = 400;
var points:Array = generateArrayOfPoints(numPoints);
function generateArrayOfPoints(num:Number):Array {
var arr:Array = new Array();
for(var i=0; i
// Objects has 4 properties: (x, y) - position vector, (vx, vy) - velocity vector
arr.push(new Object( {x:Math.random()*stageWidth, y:Math.random()*stageHeight, vx: (Math.random()-0.5)*speed, vy: (Math.random()-0.5)*speed} ));
}
return arr;
}
function movePoints(arr:Array) {
var len = arr.length;
for(var i=0; i
p.x += p.vx;
//check for if it left the screen
if( p.x>stageWidth || p.x<0 ) {
//reverse the x velocity
p.vx*=-1;
p.x += p.vx;
}
p.y += p.vy;
if( p.y>stageHeight || p.y<0 ) {
//reverse the y velocity
p.vy*=-1;
p.y += p.vy;
}
}
}
function plotPoints(mc:MovieClip, arr:Array) {
mc.lineStyle(2,0xaaaaaa,100);
var len = arr.length;
//position the pen on our first point in the array
mc.moveTo(arr[0].x,arr[0].y);
//cycle through our points array
for(var i=0; i
mc.lineTo(arr[i].x,arr[i].y);
}
}
onEnterFrame = function() {
//clear the canvas
this.clear();
//calculate new positions for our array
movePoints(points);
//plot the lines
plotPoints(this,points);
}
Related content
Comments: 126
wonderwhy-ER In reply to ??? [2006-11-25 21:44:41 +0000 UTC]
Ehh. I don like thous filters to be honest. Too laggy sometimes. But looks beter than alpha or color change.
👍: 0 ⏩: 1
ArtBIT In reply to wonderwhy-ER [2006-11-26 00:50:53 +0000 UTC]
They're laggy only if you have a big rectangle to process, I think that even if you had only two lines about 200px long, crossed over each other, the filter would process them as slow as some complex 200x200 movieClip, but don't quote me on that cuz I didn't test it
👍: 0 ⏩: 1
wonderwhy-ER In reply to ArtBIT [2006-11-26 09:58:17 +0000 UTC]
I know that when many moveclips cross each other and blur is used on them he starts to lag to compute the final result. But size of the picture gives the biggest impact on performance becouse those effects are based on pixel manipulation. So to create final blur it goes trough all the pixels. So for each moveclip blur creates a bitmap and blures it. So i can say that it is something like sum(SizeX[i]*SizeY[i])
👍: 0 ⏩: 0
wonderwhy-ER In reply to ??? [2006-11-24 13:42:31 +0000 UTC]
I will try it any way To be honest bluring or alpha gives more problems than that. I am planing to not use them at all this time
👍: 0 ⏩: 0
Dijabolik In reply to ??? [2006-11-24 10:12:42 +0000 UTC]
I triped and fav it!! yuou should make another game with this and use this thing , my friend...
👍: 0 ⏩: 1
ArtBIT In reply to Dijabolik [2006-11-26 16:42:17 +0000 UTC]
You took too much man, you took too much...
👍: 0 ⏩: 0
ArtBIT In reply to Dregnought [2006-11-26 16:50:31 +0000 UTC]
Thanks mate , and thanks for the feature
👍: 0 ⏩: 1
AprilEchidna In reply to ??? [2006-11-24 07:51:06 +0000 UTC]
Awesome stuff, really fun to play around with. I think it's taken over my mind though XD
👍: 0 ⏩: 1
ArtBIT In reply to AprilEchidna [2006-11-26 16:48:20 +0000 UTC]
(((((((MUST)))))))(((((((PLAY)))))))((((((SOME)))))))(((((((MORE)))))))
👍: 0 ⏩: 1
<= Prev |