最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Custom path animation using JQuery - Stack Overflow

programmeradmin1浏览0评论

I've created this android app that sends onTouchEvents points to a web server, and I have a page which gets the motion points JSON data via Ajax like so:

{"data":[
{"x":224.28035,"y":235.4906},
{"x":263.32916,"y":219.45718},
{"x":293.3667,"y":215.44885},.....]}

Now I want to use this data and animate a div on the screen with smooth path animation, similar to flash path animation, is there a plugin that solves this issue?

PS: .path/ does not seem to have a custom path animation, or I may be missing something.

Thanks :)

I've created this android app that sends onTouchEvents points to a web server, and I have a page which gets the motion points JSON data via Ajax like so:

{"data":[
{"x":224.28035,"y":235.4906},
{"x":263.32916,"y":219.45718},
{"x":293.3667,"y":215.44885},.....]}

Now I want to use this data and animate a div on the screen with smooth path animation, similar to flash path animation, is there a plugin that solves this issue?

PS: http://weepy.github./jquery.path/ does not seem to have a custom path animation, or I may be missing something.

Thanks :)

Share Improve this question asked Feb 8, 2012 at 14:28 Shlomi SchwartzShlomi Schwartz 8,91330 gold badges119 silver badges198 bronze badges 1
  • github./weepy/jquery.path – vsync Commented Jan 30, 2013 at 1:55
Add a ment  | 

2 Answers 2

Reset to default 8

Hopefully this is the one you're searching for: jQuery plugin crSpline

You can see its demo in here.

pathAnimator

Ultra-lightweight, high performance with a nice range of settings.

Example:

var path         = "M150 0 L75 200 L225 200 Z"; // an SVG path
    pathAnimator = new PathAnimator( path ),   // initiate a new pathAnimator object
    speed        = 6, // seconds that will take going through the whole path
    reverse      = false,  // go back or forward along the path
    startOffset  = 0,   // between 0% to 100%
    easing = function(t){ t*(2-t) };  // optional easing function


pathAnimator.start(speed, step, reverse, startOffset, finish, easing);

function step( point, angle ){
    // do something every "frame" with: point.x, point.y & angle
}

function finish(){
    // do something when animation is done
}
发布评论

评论列表(0)

  1. 暂无评论