import hype.extended.behavior.FixedVibration;
import hype.extended.behavior.VariableVibration;
import hype.extended.color.ColorPool;
import hype.framework.core.ObjectPool;
import hype.framework.core.TimeType;
import hype.framework.display.BitmapCanvas;
import hype.framework.rhythm.SimpleRhythm;
var myWidth = stage.stageWidth;
var myHeight = stage.stageHeight;
var bmc:BitmapCanvas = new BitmapCanvas(myWidth, myHeight);
addChild(bmc);
var clipContainer:Sprite = new Sprite();
var color:ColorPool = new ColorPool(
0x587b7C, 0x719b9E, 0x9FC1BE, 0xE0D9BB, 0xDACB94, 0xCABA88, 0xDABD55, 0xC49F32, 0xA97409
);
var pool:ObjectPool = new ObjectPool(MyCircle, 13);
function addNextClip(r:SimpleRhythm) {
if (pool.isFull) {
rhythm.stop();
} else {
pool.request();
}
}
pool.onRequestObject = function(clip) {
clip.x = myWidth / 2;
clip.y = myHeight / 2;
clip.scaleX = clip.scaleY = 0;
color.colorChildren(clip);
// target Object, property, spring, ease, vibrationRange
var xVib:VariableVibration = new VariableVibration(clip, "x", 0.9, 0.3, 10);
var yVib:VariableVibration = new VariableVibration(clip, "y", 0.9, 0.3, 10);
xVib.start();
yVib.start();
// target Object, property, spring, ease, min, max, isRelative
var sVib:FixedVibration = new FixedVibration(clip, "scale", 0.99, 0.05, 0.5, 1.0, false);
sVib.start();
clipContainer.addChild(clip);
}
var rhythm:SimpleRhythm = new SimpleRhythm(addNextClip);
rhythm.start(TimeType.TIME, 250);
bmc.startCapture(clipContainer, true);