tracerstar

This site is no longer maintained and will eventually have the articles rehosted. In the meantime, please visit my current portfolio, Benjamin Fox Studios.

Bezier curve behaviour

HYPE Framework Bezier behavior class | download (v0.1)

Basic usage:

import flash.geom.Point;
import hype.framework.core.ObjectPool;
import hype.extended.behavior.FixedVibration;
import Bezier;

var pool:ObjectPool = new ObjectPool(MyCircle, 200);
var r:Number = 0;

pool.onRequestObject = function(clip) {
	
	var i = pool.activeSet.length;
	
	var bez:Bezier = new Bezier(clip, new Point(50, 200), new Point(550, 200), new Point(300, 50), new Point(300, 350), 200, i);
	
	bez.runBehavior();
	addChild(clip);
	
	clip.rotation = r;
	
	r += 3;
}

pool.requestAll();

As an aide while developing the artwork, you can pre-visualise the path of the curve by using the call to showHandles(). This will return a MovieClip with the path drawn out and the control handles shown.

import flash.geom.Point;
import hype.framework.core.ObjectPool;
import hype.extended.behavior.FixedVibration;
import Bezier;

var pool:ObjectPool = new ObjectPool(MyCircle, 200);
var r:Number = 0;

pool.onRequestObject = function(clip) {
	
	var i = pool.activeSet.length;
	
	var bez:Bezier = new Bezier(clip, new Point(50, 200), new Point(550, 200), new Point(300, 50), new Point(300, 350), 200, i);
	
	bez.runBehavior();
	addChild(clip);
	
	if (i == 200) {
		addChild(bez.showHandles());
	}
	
	clip.rotation = r;
	
	r += 3;
}

pool.requestAll();

0 Responses to Bezier curve behaviour

Leave a Reply