I would like to create a scrolling counter and I'm wondering on how to implement this. Should I use for each digit a separate view and animate the view upwards or downwards to create the scrolling effect?
Or is there a better way to do this ?
I would like to create a scrolling counter and I'm wondering on how to implement this. Should I use for each digit a separate view and animate the view upwards or downwards to create the scrolling effect?
Or is there a better way to do this ?
Since there are only 10 possible transitions, you could pre-render them and have more detailed animation. Otherwise, what you described seems appropriate. Just thought I'd suggest it.
You could make a vertical strip of numbers 0 through 9 and then animate changing the strip's frame's origin.
To get a "seamless" effect, "glue" three strips together vertically and animate changing their origins.
If your counter is increasing and animation causes the bottommost strip to move outside of bounds, add another strip to the top —- and vice versa, if the counter is decreasing.
Should I use for each digit a separate view and animate the view upwards or downwards to create the scrolling effect?
Probably your best bet. At very least, this strategy should allow you to effectively manage the complexity involved. The "direction" you animate in is simply a stylistic decision.