More rummaging

Found another old quick experiment I figured I’d share:


[SWF(width=550, height=400, backgroundColor=0x462300, frameRate=30)]
var objList:Vector.<object> = new Vector.</object><object>();
var main:Object = {X:275, Y:200, ang:Math.random(), size:8};
filters = [new BevelFilter(4, 45, 0xc9edc0, 1, 0x202220, 1, 8, 8), new DropShadowFilter(8, 45, 0, 1, 2, 2)];
addEventListener(Event.ENTER_FRAME, loopHandler);
function loopHandler(e:Event):void {
	drawVine(main, Shape(addChild(new Shape())), true);
	if (Math.random() > .9) objList.push({X:main.X, Y:main.Y, ang:main.ang+.5-Math.random(), size:main.size*.6});
	while (objList.length > 4) objList.shift();
	for (var n:int = 1; n < objList.length; n++) {
		if (Math.random() > .4) drawVine(objList[n], Shape(addChild(new Shape())));
	}
	while (numChildren > 185) removeChildAt(0);
}
function drawVine(obj:Object, holder:Shape, isMain:Boolean = false):void {
	obj.size = (obj.size>2.5) ? obj.size + .7-Math.random()*1.4 : 3 + .5-Math.random()*1.001;
	holder.graphics.lineStyle(obj.size, 0x4A641C);
	holder.graphics.moveTo(obj.X, obj.Y);
	obj.ang += .300-Math.random()*.600;
	obj.X += 10*Math.cos(obj.ang);
	obj.Y += 10*Math.sin(obj.ang);
	holder.graphics.lineTo(obj.X, obj.Y);
	this.x -= (isMain) ? 10*Math.cos(obj.ang) : 0;
	this.y -= (isMain) ? 10*Math.sin(obj.ang) : 0;
	if (Math.random() > .94) {
		holder.graphics.lineStyle(obj.size * .3, 0x4A641C);
		holder.graphics.beginFill(0xcc9300);
		holder.graphics.drawCircle(obj.X+Math.cos(obj.ang)*obj.size*2, obj.Y+Math.sin(obj.ang)*obj.size*2, obj.size*1.12);
	}
}</object>

Leave a Reply