Add rotate option + lint the code + update demos and Readme #5

Merged
merged 1 commit into from Aug 17, 2012

Conversation

Projects
None yet
5 participants

No description provided.

Hi weepy,

It's been a long time since you haven't updated this project.
Is there any chance that you would accept this pull request?

Regards,
Lr

katowulf commented Aug 6, 2012

Louis,

Do you have a branch with the current pull request and updates? Does yours work with latest jQuery by any chance? Maybe we could officially fork this?

weepy added a commit that referenced this pull request Aug 17, 2012

Merge pull request #5 from louisremi/rotateOption
Add rotate option + lint the code + update demos and Readme

@weepy weepy merged commit ac52403 into weepy:master Aug 17, 2012

Can you add some examples of using the rotate option? I'd like to use it, but I couldn't get it to work, and there's nothing in the documentation about it.

Ditto. "rotate" doesn't work as a parameter of any of the used functions.
Possible missing code? Keep reading:

I'm trying to store somewhere the value of the last step angle, to pick-up the next animation right where this one was stop()ed, and I can't get it to work. (Without manually coding the whole step in my code (which defeats the whole purpose of this plugin)
(I don't want to rotate the elements itself)

The closest I've been is adding a css.rightMargin to fx.elem.style and later removing the px from the value… but after hours of trying to send the angle right to the element.data or as a custom $.cssHooks["currAngle"]… so now I just noticed the element is NEVER rotated, because prevX is NEVER setup.
I tried setting rotate: true everywhere, no success. Where should it go?

Do you think a better way to send it to the element? (keeping the elegancy of this plugin)

@socialblogsite Check out my fork - https://github.com/DanielSchaffer/jquery.path (note: I submitted a pull request here 2 weeks ago, but haven't seen any response yet)

I've added the ability to rotate, including what I believe to have been the intended functionality for this (keeping the element "faced forward" along the path), and also adding a spin using options similar to the arc path. Please note that using rotation requires the transform css hook (https://github.com/brandonaaron/jquery-cssHooks/blob/master/transform.js) - the "rotate" code here is also dependent on it, though it's not documented anywhere.

If my fork doesn't get you where you need to go on its own, I've also added the concept of a separate "rotator" module that can be used with any path, so you should be able to add your own rotator that does what you need.

Oh, thanks.
I did add the proper cssHook for the property I created… but never tried deleting yours, which was probably preventing the whole script from working.
Ohhh… now I realize I use jquery.transform for that!!
I believed the cssHook for transform was included in the new version of jQuery :(

Does the separate "rotator" module provide the step-by-step angle to be used somewhere else?

…cause I don't need to rotate something else, nor get another value animated. I just need to output (or hook into some part of path functions to retrieve it ?) the angle at the time the animation is stopped in any way.

I first aimed to calculate the angle (again) from the current position from the outside, but it ended up being a pain when combined with an extra rotation I'm added to the whole thing (you can see it at the page in construction http://flakeyfish.com/hangouts/ )
(so far it works in chrome and you need a to be logged into facebook for it to work) (renders 20 friends of yours in an animated wheel)

As you can see, I modified the original jquery.path.js to send the value as marginRight, since it's irrelevant anyway for a floated element ;)
as I found out css properties unknown by the browser are ignored anyway (I thought they would work at least in jQuery context regardless of being rendered or not)

I'm not an expert coder other than css and enough Wordpress to do what you see there, so the code you see there is more than sloppy, hehe. I'm sure all that script and the whole path plugin could have been replaced by 10 lines of code, but… I've got what I needed :)

Thanks for your answer, Daniel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment