//--------------------------------- // bretzel orgie // // date: 2006.03.16 // author: erational.org // version: 0.1 //--------------------------------- // parameters //----------------------------------- item = 0; // nb elements d = 4; // drawing speed state = "nothing"; // state px = 200; // pointer current x py = 200; // pointer current y dx = -1; // direction x dy = 0; // direction y entropy = 4; //105; // entropy level 0: very unstable 100000: stable // init //----------------------------------- fscommand("allowscale",false); fscommand("showmenu",false); px2 = px; py2 = py; current_col = rand_color(); // function //----------------------------------- function rand(range) { return Math.floor(Math.random()*range); } function new_event(prob) { if (rand(prob)==0) return true; else return false; } function change_direction() { p = rand(4); switch (p) { case 0: dx=0; dy=1; break; case 1: dx=1; dy=0; break; case 2: dx=0; dy=-1; break; case 3: dx=-1; dy=0; break; } } function rand_color() { return Math.round( Math.random()*0xFFFFFF ); } // main //----------------------------------- _root.onEnterFrame = function() { if (state=="nothing") { // create new element item++; _root.createEmptyMovieClip("mc"+item,1+item); px2 = px; py2 = py; state = "growing"; } else if (state=="growing") { // growing px2 += dx * d ; py2 += dy * d; _root["mc"+item].clear(); _root["mc"+item].lineStyle(1, current_col, 30 + rand(60)); _root["mc"+item].moveTo(px, py); _root["mc"+item].lineTo(px2, py2); // change state ? if (new_event(entropy)) { state = "nothing"; px = px2; py = py2; if (px<-100||px>1000) px = rand(1000); if (py<-100||py>1000) py = rand(1000); change_direction(); current_col = rand_color(); } } // deconstruction /* scale = 100 + (_xmouse - 800/3000); //trace (scale); this._xscale = scale; this._yscale = scale; this._x = _xmouse; this._y = _ymouse; */ }