Hello all. A kind Kirupa user gave me this code for an animation experiment that I am wanting to make.
I have quite limited with AS3 and things get a bit complicated when I want to apply this effect into a sphere.
I would appreciate any guidance. I am not asking for a direct answer but any direction from you experts would be great. Thank you all.
import flash.display.BlendMode;
var vertex:Point=new Point(1000/2,1000/2);
var bigCircle:Sprite = new Sprite();
bigCircle.cacheAsBitmap=true;
bigCircle.graphics.beginFill(0x000000);
bigCircle.graphics.drawCircle(0, 0, 1000/2);
bigCircle.graphics.endFill();
bigCircle.x=vertex.x;
bigCircle.y=vertex.y;
addChild(bigCircle);
var circleMask:Sprite = new Sprite();
circleMask.blendMode='layer';
addChild(circleMask);
var maskBox:Sprite = new Sprite();
maskBox.blendMode='layer';
maskBox.graphics.beginFill(0xffffff);
maskBox.graphics.drawRect(0,0,1000, 1000);
maskBox.graphics.endFill();
var maskCircles:Sprite = new Sprite();
maskCircles.blendMode='erase';
for (var h=0; h<1000; h+=5) {
for (var w=0; w<1000; w+=5) {
maskCircles.graphics.beginFill(0x000000);
maskCircles.graphics.drawCircle((2+w), (2+h), 2);
maskCircles.graphics.endFill();
}
}
circleMask.addChild(maskBox);
circleMask.addChild(maskCircles);
var bmp = new Bitmap();
var bdata=new BitmapData(1000,1000,true,0);
bdata.draw(circleMask);
bmp.bitmapData=bdata;
bmp.cacheAsBitmap=true;
removeChild(circleMask);
addChild(bmp);
bigCircle.mask=bmp;