Iván, looking really nice... one quick suggestion from something i saw
in your sample code...
var pOrigin = {x: 200, y:100};
//use null as 1st parameter if adding the segments later
motionpath = new Bezier(null, {origin:pOrigin});
In your class you could use Array.link to link the object argument to
the options parameter, and the array type to the segments parameter.
That would allow the user to do any of the following:
var pOrigin = {x: 200, y:100};
var bs1 = new BezierSegment([40, 320], [300, 60], [40, 200], [140, 60]);
var bs2 = new BezierSegment([300, 60], [280, 400], [440, 140], [460,
400]);
var motionpath1 = new Bezier([bs1, bs2]);
var motionpath2 = new Bezier({origin:pOrigin});
var motionpath3 = new Bezier([bs1, bs2], {origin:pOrigin});
var motionpath4 = new Bezier({origin:pOrigin}, [bs1, bs2]);
basically, youd do something like the following...
initialize: function(){
var params = Array.link(arguments, { segments:Array.type,
options:Object.type});
this.setOptions(params.options || {});
this.segments = params.segments || [];
...
}
check the mootools source for more examples of this in use.
- Tom
On Oct 21, 2008, at 12:08 AM, Iván N Paz wrote:
Hi, I updated a bit the plugin, the page with the description and
the sample...
See it here if interested:
http://ivanicus.com/articles/1-mootools/1-mootools-motion-the-bezier-way
If you want to comment, make suggestions, requests for functionality,
by all means, contact me!!!
Cheers to you all!
Iván