Made with ❤️ by Chili Labs.
Easy customizable animated text change library.
- Implemented as extension methods for TextView so it can be easily integrated into existing projects
- Bundles 6 pre-defined animations
- Provides easy way to use complex animations simply by configuring properties
- Provides possibility to write you own animation by implementing CharacterChangeAnimation
Gradle:
Add Jitpack to your root build.gradle
file:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
...
}
}
Add dependency to application build.gradle
file, where x.y.z
is the latest release version:
implementation "com.github.ChiliLabs:ChiliTextAnimation:x.y.z"
Call animateCharacterChange
with preferred animation and duration in milliseconds.
animation
- required. Pre-defined animation or your CharacterChangeAnimation implementationduration
- not required. Animation duration, default value - 1 second
textView.animateCharacterChange(
animation = FadeCharacterAnimation(),
duration = 500L
)
Call animateCharacterChange
overload with lambda and specify animation configuration
Property | Recommended value | Default value | Description |
---|---|---|---|
alpha |
0f..1f | 1f | End value for character to be replaced, start value for new character |
textSizeCoef |
0f..1f | 1f | newTextSize = textSize * textSizeCoef . End value for character to be replaced, start value for new character |
charWidthCoef |
0f..1f | 1f | textScaleX = charWidthCoef End value for character to be replaced, start value for new character |
translationXCoef |
-1f..1f | 0f | xOffset = symbolWidth * translationXCoef . Positive value - slide right, negative - left |
translationYCoef |
-1f..1f | 0f | yOffset = height * translationYCoef . Positive value - slide up, negative - down |
duration |
N | 1000L | Animation duration in milliseconds |
But despite the recommendations, you definitely should play around with property values to get some extraordinary animations
textView.animateCharacterChange {
alpha = 0f
charWidthCoef = 0f
translationXCoef = 1f
duration = 1000L
}
Copyright 2020 Chili Labs
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.