If anyone's interested on working on this, I've thrown something of a starting point together (AS3).
Create a new file, add a movieclip called mcAtom to the library (make sure you export it for actionscript). Give it 3 frames, one with a circle of each colour.
Put this code on the root timeline:
var aAtoms:Array = new Array();
for( var i:int = 0; i < 300; i++ )
{
var mc:mcAtom = new mcAtom();
mc.gotoAndStop( Math.ceil( Math.random() * 3 ) );
mc.cX = 400;
mc.cY = 300;
mc.radius = 200;
mc.phase = Math.random() * 360;
mc.velocity = 2 + Math.random() * 2;
mc.phaseX = Math.random() * 360;
mc.velocityX = 2 + Math.random() * 2;
mc.phaseY = Math.random() * 360;
mc.velocityY = 2 + Math.random() * 2;
addChild( mc );
aAtoms.push( mc );
}
And put this code in mcAtom.as:
package
{
import flash.display.*;
import flash.events.*;
public class mcAtom extends MovieClip
{
public var cX:Number;
public var cY:Number;
public var radius:Number;
public var phase:Number;
public var phaseX:Number;
public var phaseY:Number;
public var velocity:Number;
public var velocityX:Number;
public var velocityY:Number;
public function mcAtom() : void
{
addEventListener( Event.ENTER_FRAME, this.atomize );
}
public function atomize( e:Event ) : void
{
this.phase = ( this.phase + this.velocity ) % 360;
this.phaseX = ( this.phaseX + this.velocityX ) % 360;
this.phaseY = ( this.phaseY + this.velocityY ) % 360;
this.x = this.cX + Math.cos( this.phaseX * Math.PI / 180 ) * this.radius * Math.cos( this.phase * Math.PI / 180 );
this.y = this.cY + Math.sin( this.phaseY * Math.PI / 180 ) * this.radius * Math.sin( this.phase * Math.PI / 180 );
this.scaleX = ( Math.cos( this.phase * Math.PI / 180 ) + 1.1 ) / 2;
this.scaleY = this.scaleX;
}
}
}
Not the most elegant, but it seems to do the job so far. Can probably be improved on, but I really need to get some sleep before work in 5 hours.
