Skip to content

jeakey/Keyframes.Pathfinder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keyframes.Pathfinder

This plugin for jQuery.Keyframes generates complex movement paths.

Simple Bezier Curve

$.keyframe.bezierPath( rules, [startX,startY], [endX,endY], [pullX,pullY] );

Super simple example:

var rules = $.keyframe.bezierPath( { name: 'curvy' } , [1,1], [400,1], [200,300] );
$.keyframe.define([rules]);
$(window).load(function(){
  $('.block').playKeyframe('curvey 5000 ease 0 1 normal forwards');
});

Advanced Bezier Curve

$.keyframe.bezierPath( rules, [startX,startY], [endX,endY], [pull1X,pull1Y], [pull2X,pull2Y] );

Simple example:

var rules = $.keyframe.bezierPath( { name: 'curvyplus' }, [1,100], [800,100], [400,-100], [50, 600]);
$.keyframe.define([rules]);
$(window).load(function()
  $('.block').playKeyframe('curveyplus 5000 ease 0 1 normal forwards');
});

Circular Paths

$.keyframe.circlePath( rules, [centerX, centerY], radius);

Simple Example:

var rules = $.keyframe.circlePath( { name: 'circular' }, [100, 100], 40);
$.keyframe.define([rules]);
$(window).load(function()
  $('.block').playKeyframe('circular 5000 linear 0 infinite normal forwards');
});

Options

By default the paths are set to 100 steps, but you can change them to suit your needs...

$.keyframe.pathfinderOpts.bezierSteps = 100;
$.keyframe.pathfinderOpts.circleSteps = 100;

Toys

http://jsfiddle.net/krazyjakee/N652c/ - Bubbles in space game.

About

A plugin for jQuery.Keyframes that generates complex movement paths

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors