Skip to content

Commit

Permalink
Add Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
APetjko committed May 20, 2020
1 parent 608e70a commit bbf12dd
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 4 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
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.
Expand Down
94 changes: 93 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,93 @@
# ChiliTextAnimation
# ChiliTextAnimation

Made with ❤️ by [Chili Labs](https://chililabs.io).

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] (https://github.com/ChiliLabs/ChiliTextAnimation/tree/master/chilitextanimation/src/main/java/lv/chi/chilitextanimation/animation)
* Provides easy way to use complex animations simply by [configuring properties] (https://github.com/ChiliLabs/ChiliTextAnimation/blob/master/chilitextanimation/src/main/java/lv/chi/chilitextanimation/configuration/CharacterChangeAnimationConfig.kt)
* Provides possibility to write you own animation by implementing [CharacterChangeAnimation] (https://github.com/ChiliLabs/ChiliTextAnimation/blob/master/chilitextanimation/src/main/java/lv/chi/chilitextanimation/configuration/CharacterChangeAnimation.kt)

<img src="img/demo.gif" width="337" height="600">

## Setup

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](https://github.com/ChiliLabs/ChiliTextAnimation/releases):

[![](https://jitpack.io/v/ChiliLabs/ChiliTextAnimation.svg)](https://jitpack.io/#ChiliLabs/ChiliTextAnimation)

```
implementation "com.github.ChiliLabs:ChiliTextAnimation:x.y.z"
```

## Usage

### Pre-defined animations

Call `animateCharacterChange` with preferred animation and duration in milliseconds.
* `animation` - required. Pre-defined animation or your [CharacterChangeAnimation] (https://github.com/ChiliLabs/ChiliTextAnimation/blob/master/chilitextanimation/src/main/java/lv/chi/chilitextanimation/configuration/CharacterChangeAnimation.kt) implementation
* `duration` - not required. Animation duration, default value - 1 second

```kotlin
textView.animateCharacterChange(
animation = FadeCharacterAnimation(),
duration = 500L
)
```

### Custom animations

Call `animateCharacterChange` overload with lambda and specify animation [configuration] (https://github.com/ChiliLabs/ChiliTextAnimation/blob/master/chilitextanimation/src/main/java/lv/chi/chilitextanimation/configuration/CharacterChangeAnimationConfig.kt)

| 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

```kotlin
textView.animateCharacterChange {
alpha = 0f
charWidthCoef = 0f
translationXCoef = 1f
duration = 1000L
}
```

## License

```
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.
```
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
}
ext.versions = [
lib : [
code: 1,
name: "0.1.0"
code: 2,
name: "0.1.1"
],
sdk : [
min : 21,
Expand Down
Binary file added images/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ android {
dependencies {
implementation project(":chilitextanimation")

//implementation "com.github.ChiliLabs:ChiliTextAnimation:0.1.1"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.core:core-ktx:1.2.0"
Expand Down

0 comments on commit bbf12dd

Please sign in to comment.