Git Product home page Git Product logo

Comments (6)

scottbedard avatar scottbedard commented on July 30, 2024 1

I don't think it's necessary to pull in additional libraries. I've thrown together a proof of concept that I can push up in just a few minutes, just cleaning some things up right now. If you look at it and decide you'd rather use a library like Tween, no worries, just go ahead and close the PR when I open it 🙂

from vueuse.

scottbedard avatar scottbedard commented on July 30, 2024 1

Awesome, thanks for letting me wedge those two utils into this library 😄

from vueuse.

antfu avatar antfu commented on July 30, 2024

This looks very useful, but my concern is that this can be over complicated to implement well and may surpass the goal of VueUse. Libraries like tween.js are much more mature and flexible to this, maybe we could add a wrapper addon for that?

from vueuse.

scottbedard avatar scottbedard commented on July 30, 2024

@antfu ok I've pushed up what I've done. This is the only complicated bit, it creates a function that we can use to get the corresponding value at various points in the transition. Let me know if you're ok with this amount of complexity in this library, because if so there are a couple changes I want to make before merging.

It's mostly just cleanup, but I'd also like to refactor it to use an raf loop instead of timeouts for smoother transitioning and getting rid of the "steps" concept. Also I'm not sure if I like the name useStateEasing and the object properties, do you have any thoughts on these? I hate naming things lol

from vueuse.

scottbedard avatar scottbedard commented on July 30, 2024

@antfu ok, we should be good to go now. I've made the refactor to a raf loop. I'm pleased with how it came out, the transition is much smoother now.

I made a couple other changes, let me know if you have any opinions on these...

  1. Renamed "easing" to "transition", I think it's a bit more descriptive of what this utility is for
  2. If the base number changes while state is still transitioning, the new transition will just start from wherever the previous one left off
  3. It no longer rounds transitioned value. It occurred to me that people will likely want to use this with monetary values, so we should let them decide how to round things

Let me know if there is anything else you need from me 🙂

from vueuse.

antfu avatar antfu commented on July 30, 2024

Shipped in v0.0.23. Thanks :)

from vueuse.

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.