Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

moofx().bezier([x,y], [x,y]) maybe? #14

Open
oskarkrawczyk opened this issue Oct 27, 2012 · 4 comments
Open

moofx().bezier([x,y], [x,y]) maybe? #14

oskarkrawczyk opened this issue Oct 27, 2012 · 4 comments

Comments

@oskarkrawczyk
Copy link

More of a suggestion than an issue.

You think it's possible to utilize moofx in some way so it can be use to animate on a bezier curve?

@arian
Copy link
Contributor

arian commented Oct 27, 2012

You can already do some things like: http://jsfiddle.net/GMXuF/14/

@arian
Copy link
Contributor

arian commented Oct 27, 2012

Also what is your main goal, I mean, you can have bezier curves with n points, and you could write a solver for that (as described on http://en.wikipedia.org/wiki/B%C3%A9zier_curve for example). But then you must realize you can't easily translate that to the CSS3 timing function trick I used in the above jsfiddle, and you'll have to use the fx class (the JS-animate-anything 'fallback').

@oskarkrawczyk
Copy link
Author

Didn't actually thought about using a custom equation, thanks for pointing it out Arian!

Generally the perfect scenario would be to set up a few x/y points in relation to the original position of the element, a bezier would automatically specify the animation path between each point. Now my math skills suck, so I was kind of hoping having a bezier method would be something that'd be interesting to more people than just me.

Edit: not that familiar with the terminology, so just googled a bit and what I describe above is a cubic/poly

@kamicane
Copy link
Owner

You can use the base fx class for any non-dom related animations, or to have a completely custom animation.
Just require("moofx/lib/fx") or pass a function to moofx() rather than an element (i call this a renderer). This way you will get the base animation framework which is completely disconnected from css stuff. You can still use cubic beziers, or custom functions for equations.

An example would be:

moofx(function(now){someElement.style.left = now + 'px'}).start(0, 100, {equation: Penner.Equations.BounceBackWhatevs});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants