Treatkor mentioned levitated.net in a post about Chaoswarp’s Box Fitting entry, which in itself is quite cool. After having a look around I was inspired to recreate [URL=“http://levitated.net/daily/levMainVein.html”]‘Main Vein’ in 25 lines.
My first attempt yielded different results to what I was aiming for, but I liked it anyway!
Scribbler:
_global.oldPoint = new Object();
_global.oldPoint.x = _global.oldPoint.y=0;
_global.branches = [null];
_root.createEmptyMovieClip("slate_mc", 1).onEnterFrame = function() {
//this.lineStyle(Math.round(Math.random()*10), (Math.random()*0xFFFFFF), 100);
var point:Object = {x:(Math.random()*Stage.width/20)+(_global.oldPoint.x)-(Math.random()*20), y:(Math.random()*Stage.height/20)+(_global.oldPoint.y)-(Math.random()*20)};
this.lineTo(point.x, point.y);
_global.oldPoint = point;
(Math.random()>0.95) ? this.lineStyle(Math.round(Math.random()*10), (Math.random()*0xFFFFFF), 100) : null;
if (!dragging) {
this._x = (Stage.width/2-point.x);
this._y = (Stage.height/2-point.y);
}
};
_root.slate_mc.onMouseDown = function() {
this.startDrag();
dragging = true;
};
_root.slate_mc.onMouseUp = function() {
this.stopDrag();
dragging = false;
};
Veins:
_global.oldPoint = new Object();
_global.oldPoint.x = _global.oldPoint.y=_global.oldPoint.x2=_global.oldPoint.y2=_global.oldPoint.x3=_global.oldPoint.y3=_global.oldPoint.x4=_global.oldPoint.y4=0;
_root.createEmptyMovieClip("slate_mc", 1).lineStyle(3, 0xFF0000, 100);
_root.slate_mc.activeFrame = _root.slate_mc.count=0;
_root.slate_mc.onEnterFrame = function() {
var point:Object = {x:(_global.oldPoint.x)+(Math.random()*Stage.width/15)*((Math.random()*2)+1), y:(_global.oldPoint.y)+(Math.random()*Stage.height/15)*((Math.random()*2.5)-1), x2:_global.oldPoint.x, y2:_global.oldPoint.y, x3:_global.oldPoint.x2, y3:_global.oldPoint.y2, x4:_global.oldPoint.x3, y4:_global.oldPoint.y3};
this.lineTo(point.x, point.y);
if (!dragging) {
this._x = (Stage.width/2)-_global.oldPoint.x4;
this._y = (Stage.height/2)-_global.oldPoint.y4;
}
_global.oldPoint = point;
(Math.random()>0.9) ? this.count=drawBranch(this, this.count, point) : null;
this.activeFrame = 0;
};
function drawBranch(obj, count, point) {
(count>=10) ? count=0 : count++;
obj.createEmptyMovieClip("branch"+count, count)._x = point.x;
obj["branch"+count]._y = point.y;
obj["branch"+count]._rotation = (Math.random()*270)-45;
obj["branch"+count].steps = 1;
obj["branch"+count].lineStyle(1, 0xCC0000, 100);
obj["branch"+count].onEnterFrame = function() {
this.lineTo(Math.random()*30, (Math.random()+this.steps)*30);
this.steps++;
};
return count;
}