Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elevenetc/textsurface
A little animation framework which could help you to show message in a nice looking way
https://github.com/elevenetc/textsurface
android android-library android-ui animation animation-framework
Last synced: 1 day ago
JSON representation
A little animation framework which could help you to show message in a nice looking way
- Host: GitHub
- URL: https://github.com/elevenetc/textsurface
- Owner: elevenetc
- Created: 2015-10-13T00:21:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-17T01:52:27.000Z (almost 4 years ago)
- Last Synced: 2024-10-29T17:47:13.336Z (3 months ago)
- Topics: android, android-library, android-ui, animation, animation-framework
- Language: Java
- Homepage:
- Size: 2.31 MB
- Stars: 2,364
- Watchers: 69
- Forks: 247
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TextSurface
A little animation framework which could help you to show message in a nice looking way.
### Usage
1. Create [`TextSurface`](library/src/main/java/su/levenetc/android/textsurface/TextSurface.java) instance or add it in your layout.
2. Create [`Text`](library/src/main/java/su/levenetc/android/textsurface/Text.java) instancies with [`TextBuilder`](library/src/main/java/su/levenetc/android/textsurface/TextBuilder.java) defining appearance of text and position:```Java
Text textDaai = TextBuilder
.create("Daai")
.setSize(64)
.setAlpha(0)
.setColor(Color.WHITE)
.setPosition(Align.SURFACE_CENTER).build();
```
3. Create animations and pass them to the [`TextSurface`](library/src/main/java/su/levenetc/android/textsurface/TextSurface.java) instance:
```Java
textSurface.play(
new Sequential(
Slide.showFrom(Side.TOP, textDaai, 500),
Delay.duration(500),
Alpha.hide(textDaai, 1500)
)
);
```
See full sample [`here`](app/src/main/java/su/levenetc/android/textsurface/sample/checks/CookieThumperSample.java).
### Adjusting animations- To play animations sequentially use [`Sequential.java`](library/src/main/java/su/levenetc/android/textsurface/animations/Sequential.java)
- To play animations simultaneously use [`Parallel.java`](library/src/main/java/su/levenetc/android/textsurface/animations/Parallel.java)
- Animations/effects could be combined like this:```Java
new Parallel(Alpha.show(textA, 500), ChangeColor.to(textA, 500, Color.RED))
```
i.e. alpha and color of text will be changed simultaneously in 500ms### Adding your own animations/effects
There're two basic classes which you could extend to add custom animation:
- [`AbstractSurfaceAnimation.java`](library/src/main/java/su/levenetc/android/textsurface/animations/AbstractSurfaceAnimation.java) to animate basic parameters like `alpha`, `translation`, `scale` and others. (See [`Alpha.java`](library/src/main/java/su/levenetc/android/textsurface/animations/Alpha.java) or [`ChangeColor.java`](library/src/main/java/su/levenetc/android/textsurface/animations/ChangeColor.java))
- [`ITextEffect.java`](library/src/main/java/su/levenetc/android/textsurface/interfaces/ITextEffect.java) interface which could be used for more complex animations. (See [`Rotate3D.java`](library/src/main/java/su/levenetc/android/textsurface/animations/Rotate3D.java) or [`ShapeReveal.java`](library/src/main/java/su/levenetc/android/textsurface/animations/ShapeReveal.java))### Proguard configuration
The framework is based on standard android animation classes which uses `reflection` extensively. To avoid obfuscation you need to exclude classes of the framework:
```
-keep class su.levenetc.android.textsurface.** { *; }
```### Download
```Groovy
repositories {
maven { url "https://jitpack.io" }
}
//...
dependencies {
//...
compile 'com.github.elevenetc:textsurface:0.9.1'
}
```
### Licence
http://www.apache.org/licenses/LICENSE-2.0