• Stars
    star
    2,363
  • Rank 19,462 (Top 0.4 %)
  • Language
    Java
  • Created about 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A little animation framework which could help you to show message in a nice looking way

TextSurface

A little animation framework which could help you to show message in a nice looking way.

Usage

  1. Create TextSurface instance or add it in your layout.
  2. Create Text instancies with TextBuilder defining appearance of text and position:
Text textDaai = TextBuilder
		.create("Daai")
		.setSize(64)
		.setAlpha(0)
		.setColor(Color.WHITE)
		.setPosition(Align.SURFACE_CENTER).build();
  1. Create animations and pass them to the TextSurface instance:
textSurface.play(
		new Sequential(
				Slide.showFrom(Side.TOP, textDaai, 500),
				Delay.duration(500),
				Alpha.hide(textDaai, 1500)
		)
);

See full sample here.

Adjusting animations

  • To play animations sequentially use Sequential.java

  • To play animations simultaneously use Parallel.java

  • Animations/effects could be combined like this:

    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:

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

repositories {
    maven { url "https://jitpack.io" }
}
//...
dependencies {
    //...
    compile 'com.github.elevenetc:textsurface:0.9.1'
}

Licence

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