download / 3.27 mb zip
version : 1.1.8
updated : March 23, 2010
open all | close all
upcoming HYPE events
No events.
let's keep in touch.
Keep us informed what you're working on using HYPE by connecting with us, either via e-mail or through twitter.

hype@hypeframework.org
twitter.com/hypeframework
Branden Hall

automatastudios.com
twitter.com/waxpraxis
Joshua Davis

joshuadavis.com
twitter.com/joshuadavis
flickr.com/photos/joshuadavis

Alternative content

Get Adobe Flash player

VariableVibration / 03_variableVibration
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);

Leave a Comment

[...] HYPE Dynamic Flash Animation Example [...]