Comments (6)
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.
Awesome, thanks for letting me wedge those two utils into this library 😄
from vueuse.
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.
@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.
@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...
- Renamed "easing" to "transition", I think it's a bit more descriptive of what this utility is for
- If the base number changes while state is still transitioning, the new transition will just start from wherever the previous one left off
- 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.
Shipped in v0.0.23. Thanks :)
from vueuse.
Related Issues (20)
- useDropZone files have 0 size HOT 1
- useBreakpoints adds elementPlus preset
- useScroll - Opt out of updating internal values
- useDebounceFn should support accepting functions that return promises as well as void
- useFocusWithin doesn't respond to document.hasFocus()
- Make API's of `useDropZone` and `useFileDialog` consistent HOT 1
- window.addEventListener('scroll', handleScroll); not working when add the UseScreenSafeArea HOT 1
- useMagicKeys needs the keys to be pressed in order (sometimes)
- `{combination: 'overwrite'}` option for `useFetch`
- Dependency error when `vue` is not part of the dependencies in a project
- Function wrapper for `requestAnimationFrame` synchronization
- onLongPress optional onMouseUp callback should be called with the PointerEvent
- useBreakpoint and useMediaQuery cause "Hydration text mismatch" on Nuxt HOT 1
- `onClickOutside` `ignore` option does not work as expected in Firefox when combined with input surrounded by a label
- Incorrect `createEventHook` types HOT 4
- useMask
- useFullScreen isn't working on the iphone 13 chrome browser HOT 1
- useInfiniteScroll still calls onLoadMore even though component is unmounted HOT 2
- useRouteQuery triggers reactivity twice HOT 2
- Incorrect types of the result values of `useRefs` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vueuse.