deviant art

Deviant Login Shop  Join deviantART for FREE Take the Tour
×

More from #ArtBIT


×

6,007

113 125 287
Download SWC download, 4.3 KB
-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<num; i++) {
    // create a new object and place it in the array
    // 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<len; i++) {
    var p = arr[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<len; i++) {
    //plot a line to the current point
    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);
}

Details

Stats

Submitted on
November 23, 2006
Image Size
4.3 KB
Resolution
550×400
Views
6,007 (2 today)
Favourites
113 (who?)
Comments
125
Downloads
287

License

Creative Commons License
Some rights reserved. This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 License.
URL
Thumb
Only verified accounts can report policy violations. Please check your email and click on the verification link.
* Required field
Add a Comment:
 
love 2 2 joy 7 7 wow 4 4 mad 0 0 sad 0 0 fear 0 0 neutral 0 0
:iconchisa3:
Mood: Joy ~chisa3 Jun 29, 2012  Student Artist
this was awesome! i loved it i can play this for hours and hours
Reply
:icondark-dragon-wings:
so amusing....... *insert dribble* i love it !!!!!!!!!!

ITS ATHLINIA'S birthday.... please just stop by her DA and say hello..... its gunna be my present to her :) I wouldn’t mind either if you copied and pasted this message everywhere to please : )
Reply
:iconjellomix:
Wah, so small but so very amusing. :+fav:
I love the graceful touch to it.
Reply
:iconblackvine:
Woah. As you said, hypnotic....
Reply
:iconfalarae:
~falarae Jun 12, 2007  Hobbyist Digital Artist
wow...this is so awesome...and it's great of you to put the code up, too...

did you make this using Macromedia Flash?
Reply
:iconartbit:
#ArtBIT Jun 12, 2007  Hobbyist Digital Artist
aye...
Reply
:iconswerno092:
I still cant get over how awesome this is . . .
Reply
:iconartbit:
#ArtBIT Mar 17, 2007  Hobbyist Digital Artist
It's not that awesome... just a little line experiment...
Reply
:iconswerno092:
Erm mister arbit, can you tell me the speciefic types of action scripts you used , i realy dont have a clue . . .
Reply
Add a Comment: