ScrollCounter
ScrollCounter is an iOS framework for getting a nice scrolling animation when transitioning between numbers. This framework is modeled after the animations seen in the Robinhood app.
Install / Use
/learn @stokatyan/ScrollCounterREADME
ScrollCounter
Installation
ScrollCounter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ScrollCounter'
Usage
ScrollCounter is a framework for getting a nice scrolling animation when transitioning between numbers. This framework is modeled after the animations seen in the Robinhood app.
Checkout this Medium article for a high-level look on how ScrollCounter works.
Single Digits
<img src="https://github.com/stokatyan/ReadMeMedia/blob/master/ScrollCounter/DigitScrollGif.gif" width="97" height="157" /> A scroll counter with a single digit can be created and animated in 2 lines:// Initialize a scrolling counter for the standard range between 0-9 (other ranges can be used as well).
let singleDigit = DigitScrollCounter(font: UIFont(name: "Avenir-Black", size: 150)!, textColor: .white, backgroundColor: .black, scrollDuration: 0.3, gradientColor: .black, gradientStop: 0.2)
// Scrolls to the item at the 8th index. For a DigitScrollCounter, this means scroll to the number 8.
singleDigit.scrollToItem(atIndex: 8)
Unbounded Numbers
<img src="https://github.com/stokatyan/ReadMeMedia/blob/master/ScrollCounter/NumberScrollingGif.gif" width="264" height="80.8" /> Use a `NumberScrollCounter` to handle an unbounded range of numbers:// Initialize a number counter, which is a view composed of `DigitScrollCounter`s.
let numberCounter = NumberScrollCounter(value: 1, scrollDuration: 0.33, decimalPlaces: 2, prefix: "$", suffix: "", font: font.withSize(40), textColor: .white, gradientColor: .black, gradientStop: 0.2)
// Set a new value. This will trigger the animation to show the given value.
numberCounter.setValue(123.45)
