All Projects → YvesCheung → Rollingtext

YvesCheung / Rollingtext

Licence: apache-2.0
Android TextView with rolling animation

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Rollingtext

DigitText
The module allows to translate numbers into a text equivalent. This is important in the billing.
Stars: ✭ 22 (-95.55%)
Mutual labels:  number
FSAnimatedTextView
Animated Number Text View Library
Stars: ✭ 32 (-93.52%)
Mutual labels:  number
Telephone number
Phone number validation for Ruby
Stars: ✭ 262 (-46.96%)
Mutual labels:  number
persian
Some utilities for Persian language in Go (Golang)
Stars: ✭ 65 (-86.84%)
Mutual labels:  number
Numbase
Arbitrary number base converter.
Stars: ✭ 22 (-95.55%)
Mutual labels:  number
rxjs-ninja
RxJS Operators for handling Observable strings, numbers, booleans and more
Stars: ✭ 68 (-86.23%)
Mutual labels:  number
numberbox-card
Replace input_number sliders with plus and minus buttons
Stars: ✭ 61 (-87.65%)
Mutual labels:  number
Vue Phone Number Input
A phone number input made with Vue JS (format & valid phone number)
Stars: ✭ 407 (-17.61%)
Mutual labels:  number
Pathslider
Numerical slider that follows a Bezier path
Stars: ✭ 15 (-96.96%)
Mutual labels:  number
yii2-number
A number format mask control and input for Yii2 Framework
Stars: ✭ 22 (-95.55%)
Mutual labels:  number
vue-translated
Internationalization (i18n) and localization (l10n) library for Vue.js v2.
Stars: ✭ 19 (-96.15%)
Mutual labels:  number
prototyped.js
Some common Typescript prototypes
Stars: ✭ 22 (-95.55%)
Mutual labels:  number
is-safe-integer
ES2015 Number.isSafeInteger() ponyfill
Stars: ✭ 16 (-96.76%)
Mutual labels:  number
PhoneNumberKit
Android Kotlin library to parse and format international phone numbers. Country code picker.
Stars: ✭ 124 (-74.9%)
Mutual labels:  number
Efcountinglabel
Adds animated counting support to UILabel.
Stars: ✭ 311 (-37.04%)
Mutual labels:  number
NumPad
Number Pad (inspired by Square)
Stars: ✭ 81 (-83.6%)
Mutual labels:  number
react-numeric
A react component for formatted number form fields
Stars: ✭ 30 (-93.93%)
Mutual labels:  number
React Phone Input 2
📞 Highly customizable phone input component with auto formatting
Stars: ✭ 446 (-9.72%)
Mutual labels:  number
React Native Phone Verification
The best React Native example for phone verification (an alternative to Twitter Digits).
Stars: ✭ 332 (-32.79%)
Mutual labels:  number
number-to-words
convert number into words (english, french, italian, roman, spanish, portuguese, belgium, dutch, swedish, polish, russian, iranian, roman, aegean)
Stars: ✭ 53 (-89.27%)
Mutual labels:  number

RollingTextView


preview

Download Jitpack

中文版README

Features

  • easy to use, API is similar to TextView, and the setText method can be animated with up and down rolling

  • support XML to set up common properties such as android:textSize/ android:textColor/ android:textStyle

  • highly customizable to support animation effects of any single character

Animation

Strategy

Different rolling effects can be achieved by setting different animation strategies

The default animation is to roll down when small characters change to large characters, and vice versa.

You can also specify that rolling to the same direction

The carry animation can be worked from low digit to high digit, not only for decimal. But it can only be used for strings with a length less than 10 to prevent integer from overflow. It can only be used for a sequence of characters containing 0, otherwise the calculation of the carry will be meaningless.

StrategyCompare

The order of characters

  • The sequence of characters needs to be set up to tell RollingTextView how to change from the original character to the target character
  • The common sequence of characters can be found in the CharOrder constant class
  • When multiple orders are added and all are applicable to the target character and the original character, the precedence of the previous setting will be higher
alphaBetView.addCharOrder(CharOrder.Alphabet);
alphaBetView.addCharOrder(CharOrder.UpperAlphabet);
alphaBetView.addCharOrder(CharOrder.Number);
alphaBetView.addCharOrder(CharOrder.Hex);
alphaBetView.addCharOrder(CharOrder.Binary);

charOrderCompare

Rolling fluency

The fluency of the animation can be adjusted by passing a factor parameter. The closer the factor value is to 0, the rolling will appear to be more hopping. And the closer the factor value is to 1, the more smooth the rolling is.

stickyFactor

other

More ideas can be implemented on the CharOrderStrategy interface to customize your own animation effects

Download

//jcenter
dependencies {  
    implementation 'com.yy.mobile:RollingText:x.y.z'
}

x.y.z replace with Download

Usage

XML settings

<com.yy.mobile.rollingtextview.RollingTextView
    android:id="@+id/alphaBetView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="i am text"
    android:textSize="25sp" 
    android:textColor="#1d1d1d"
    android:textStyle="bold"
    android:gravity="center"
    android:shadowColor="#ff44ffdd"
    android:shadowDx="10"
    android:shadowDy="10"
    android:shadowRadius="10"/>

write in java code

final RollingTextView rollingTextView = findViewById(R.id.alphaBetView);
rollingTextView.setAnimationDuration(2000L);
rollingTextView.setCharStrategy(Strategy.NormalAnimation);
rollingTextView.addCharOrder(CharOrder.Alphabet);
rollingTextView.setAnimationInterpolator(new AccelerateDecelerateInterpolator());
rollingTextView.addAnimatorListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
        //finsih
    }
});
rollingTextView.setText("i am a text");

Debug

Using Uinspector, You can debug the properties of RollingTextView:

debug preview

Add Uinspector to your build.gradle:

repositories {
    //...
    maven { url 'https://dl.bintray.com/yvescheung/maven/' }
}

dependencies {
    // debugImplementation because Inspector should only run in debug builds.
    debugImplementation "com.yy.mobile:RollingTextInspector:x.y.z"
}

License

Copyright 2018 Yves Cheung

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].