GithubHelp home page GithubHelp logo

monkey-tw / scrollcounter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stokatyan/scrollcounter

0.0 0.0 0.0 23 KB

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.

License: MIT License

Swift 100.00%

scrollcounter's Introduction

ScrollCounter

Version License Platform

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

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

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)

scrollcounter's People

Contributors

stokatyan avatar ngeri avatar n-ihad avatar

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.