Coder Social home page Coder Social logo

Comments (8)

julianshapiro avatar julianshapiro commented on June 9, 2024

Thanks, @nltesown :)

Supporting a true duration: 0 actually involves a series of hacks to avoid the requestAnimationFrame tick. It would likely be too considerable of a code reorg for me to implement.

However, I can make duration: 0 revert to 1 instead of 400. But, why is 1ms not satisfactory? What is your precise use case, if I may ask? I'd like to get an idea of use cases where someone would want to do this. There are likely more expressive ways to accomplish the same task.

from velocity.

nltesown avatar nltesown commented on June 9, 2024

Hi Julian,
In my idea of how it should behave (which is the way jQuery.animate behaves, I think), a duration of 0 means that no animation runs at all. For that reason, duration: 1 is not OK because you actually run an animation (and generally get some unwanted flicker). I don't realize at all what it would imply for your code, but I figured it could be possible to simply skip any animation and directly set the final values... As for my use case: I'm translating some overflowing content within a container, and in some situations I need to directly jump from one position to another. I suppose it sounds vague or too specific, and it's true that I can find a workaround anyway... but in fact I was quite surprised when I followed the straightforward idea to set duration: 0 and saw that it didn't work as expected.

from velocity.

julianshapiro avatar julianshapiro commented on June 9, 2024

Have you thought about using forcefeeding to achieve the same jumping effect? If you forcefeed a start value, Velocity will immediately start at that point. No flickering.

http://velocityjs.org/#forcefeeding

If that doesn't solve your issue, I'll look further into implementing a feature like you're describing.

from velocity.

nltesown avatar nltesown commented on June 9, 2024

Thanks, I had not noticed this advanced setting, I'll have a look.

from velocity.

TanguyS avatar TanguyS commented on June 9, 2024

Actually, my first move was exactly the same (setting duration: 0). Maybe it would be more intuitive?

from velocity.

julianshapiro avatar julianshapiro commented on June 9, 2024

K. I'm going to change 0 to default to 1 instead of 400. This change will be pushed tonight. Thanks, guys.

from velocity.

TanguyS avatar TanguyS commented on June 9, 2024

Thanks a lot Julian!

from velocity.

julianshapiro avatar julianshapiro commented on June 9, 2024

@TanguyS, @nltesown

A duration of 0 now defaults internally to 1ms instead of 400ms.

Update your copies of Velocity.

Thank you!

from velocity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.