-
Notifications
You must be signed in to change notification settings - Fork 51
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
From current value to new value #17
Comments
Hi, there is no such functionality at the moment. As you can see the library accepts Also support different length of string in {
from: 'Some text 1234',
to: 'Other text 55'
} However, this is just a matter of consistent API and could be introduced in one of the next releases as soon as I find clean solution for this. Maybe some contract between |
Hello, from now on you can use |
@coderitual am using bounty inside vue & am trying to animate the number each time it changes inside the |
This is WIP at the moment but I will put the high priority on this. Do you have something against webcomponents? I am considering API and WC would make it easier. I know that using them on prod might be a bit tricky though (es5 adapter). |
no not really, but actually the vue component was very easy to make ,ex <template>
<div/>
</template>
<script>
import bounty from 'bounty'
export default {
props: ['value'],
mounted() {
this.init(this.value, 0)
},
methods: {
init(val, old) {
bounty({
el: this.$el,
value: val,
initialValue: old,
lineHeight: 1,
letterSpacing: 1,
animationDelay: 100,
letterAnimationDelay: 100
})
}
},
watch: {
value(val, oldVal) {
setTimeout(() => {
this.init(val, oldVal || 0)
}, 100)
}
},
render() {}
}
</script> the <bounty :value="100"></bounty> btw i think |
Ok got it. I will look at these props. Two options I am considering:
|
we can also add another method this could be used when the values changes while the animation is still going. |
I think we ca go with 1 option. To consider: |
good one, so initial will get the animation to play and stop, then for any updates it would be as easy as |
Yup. Something like that. Even first animation would need calling |
mmmm, in that case the bounty instance will be mostly used for options. and // initialValue = 0
bounty.to(100)
// animate & on end set initialValue = 100 now you always get a smooth animation from the current to whatever the new value is. i honestly like this way better so the final usage would be something like export default {
props: ['value'], // ex. 100
data() {
return {
lib: null
};
},
mounted() {
this.lib = bounty({
el: this.$el,
lineHeight: 1,
letterSpacing: 1,
animationDelay: 100,
letterAnimationDelay: 100
})
this.lib.to(this.value) // animate from 0 to 100
},
watch: {
value(val) {
// ex.200
this.lib.to(val) // animate from 100 to 200
}
},
render() {}
} |
That's correct. I think we are on the same page. I will try to create some POC before the end of the week. |
Hello there, |
Hi @flowsandbits. Yes, you can create multiple instances and control them individually. Each call |
@coderitual Thank you, I've tried it and work smoothly ... :D |
@coderitual Was the from/to functionality ever added? I really like the look of this one, but if it can't do from/to, are there alternatives available? |
@orrd Only partially by |
Hello,
That's an amazing tool and that's exactly what I was looking for. Though I have a question.
Is there a way to make it start from a value, for example 2016, instead of having it starting from 0? I'm trying to make some kind of timeline where each slide starts from a value that is incremented in each slide.
The text was updated successfully, but these errors were encountered: