Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow movement not smooth #53

Open
knod opened this issue Oct 9, 2014 · 2 comments
Open

Slow movement not smooth #53

knod opened this issue Oct 9, 2014 · 2 comments

Comments

@knod
Copy link

knod commented Oct 9, 2014

Using move.set( 'left'... and move.set( 'top'..., I'm attempting to move my animations slowly across the screen, sometimes 2% towards the left, 3% towards the top in 4 seconds. When I do this the movement isn't completely smooth - it makes progress in small jerks that are noticeable at this speed.

Environment:
Mackbook Pro OSX Mavericks, Chrome 37.0.2062.122

@yields
Copy link
Contributor

yields commented Oct 9, 2014

can you try doing .translate(x, y) / .to(x, y) instead ?

@knod
Copy link
Author

knod commented Oct 10, 2014

Those and they do look a lot more smooth, which is great! Is there any way I can set either a percentage value or some pixel position instead? .to and .translate always add or subtract from the current position. Actually, I don't understand how they make their calculations.

For example:
leftDiff = currentLeft - desiredNewLeft;
topDiff = currentTop - desiredNewTop;
move( domElement ).to( leftDiff [, topDiff] );

The $(elem).offset().left of my element changes, but not by the amount of leftDiff.
Edit: Perhaps I'm not understanding my jQuery correctly, though .position().left doesn't seem to do better.

From my console log statements:
Loop 1: currL: 244.25 newL: 160.39 leftDiff: 83.86...
Loop 2: currL: 255.1512451171875 newL: 303.0712451171875 leftDiff: -47.92...
Loop 3: currL: 220.34732055664062

Even if I'm calculating leftDiff incorrectly, if I understand correctly, the next "currL" should either reflect the value of "leftDiff" or not change at all, depending on how the movement is being done.

Could you clarify on how that movement is being calculated?

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

No branches or pull requests

2 participants