Provides animation along bezier and circular arcs.
The animation engine in jQuery is focussed on single dimensional animation - hence it's difficult to animate two variables along a path.
This simple plugin provides a method of multidimensional animation, and in particular provides a method for animating along bezier curves and arcs.
Example: animate along a bezier path
var bezier_params = { start: { x: 185, y: 185, angle: 10 }, end: { x:540, y:110, angle: -10, length: 0.25 } } $("my_elem").animate({path : new $.path.bezier(bezier_params)})
Bezier curves are made form a start point, an end point each with a control point
Exampe: animate along an arc
var arc_params = { center: [285,185], radius: 100, start: 30, end: 200, dir: -1 } $("my_elem").animate({path : new $.path.arc(arc_params)})
It is trivial to create other paths, or even animate other parameters. E.g:
var SineWave = function() { this.css = function(p) { var s = Math.sin(p*20) var x = 500 - p * 300 var y = s * 50 + 150 var o = ((s+2)/4+0.1) return {top: y + "px", left: x + "px", opacity: o} } }; $("my_elem").animate({path : new SineWave})
Tested in