Git Product home page Git Product logo

textsurface's Introduction

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

textsurface's People

Contributors

elevenetc avatar ogaclejapan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textsurface's Issues

SideCut.hide() issue

Hi, have you tried SideCut.hide() with other Sides for example SideCut.hide(Side.RIGHT)?
in my example:

textSurface.play(
new Sequential(
ShapeReveal.create(textDaai, 750, SideCut.show(Side.RIGHT), false),
ShapeReveal.create(textDaai, 600, SideCut.hide(Side.RIGHT), true)));

only hide(Side.LEFT) works as expected.
Am i missing something here?
thanks in advance

Help on a transition // Alpha.Remove?

Hi
I want to do something like this:
I have a text like:
Hello
And i wan't 'e' to vanish and push the text to the left so that it says together like this:
Hllo

I don't know how to push the text to the left after i do Alpha.hide.
__

In other ways,
Is there anything like a Alpha.Remove so that the next word I insert goes in the position that I removed.

Can you help me?
Thanks

call backs for listening to animation events

Why is there no listener ? how do i know when the animation ends ? You should create a listener with hooks so i know when animation ends so i can do something when it completes. Even if i hook into setLayoutAnimationListener no call backs come.

Failed to resolve: com.github.elevenetc:textsurface:0.9.1

Hi !

I would like to use your code, but when i just add "compile 'com.github.elevenetc:textsurface:0.9.1' "
(i tried with "implementation" too), the build fail with this error...

ERROR: Failed to resolve: com.github.elevenetc:textsurface:0.9.1

Any idea to solve this issue ?

Thx !

two Text with same contents = only one shown

I have a display of album, artist and track name. All fields are separate Text objects. When two fields have the same name (as in song that has the same title as album) only one of these fields is shown. Is this a bug or a feature?

IllegalArgumentException , android 11

java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
at android.graphics.Canvas.checkValidClipOp(Canvas.java:853)
at android.graphics.Canvas.clipRect(Canvas.java:992)
at su.levenetc.android.textsurface.animations.Slide.apply(Slide.java:157)
at su.levenetc.android.textsurface.Text.onDraw(Text.java:112)
at su.levenetc.android.textsurface.TextSurface.onDraw(TextSurface.java:88)
at android.view.View.draw(View.java:22350)
at android.view.View.updateDisplayListIfDirty(View.java:21226)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
at android.view.View.updateDisplayListIfDirty(View.java:21186)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
at android.view.View.updateDisplayListIfDirty(View.java:21186)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
at android.view.View.updateDisplayListIfDirty(View.java:21186)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
at android.view.View.updateDisplayListIfDirty(View.java:21186)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)

i think the fix for this could be here: https://stackoverflow.com/q/52922866/835883

can you see how can help resolve this ? on older device not seeing the issue.

To open a new activity when the display get over.

i was trying to open the new activity as when the display or hole text is displayed and there was some problem and it is not running...so how can i open a new activity when the text id displayed.

Its not working with proguard build

i put this in my proguard build to try and help but it did not help:

-keepclasseswithmembernames class xsu.levenetc.android.textsurface.** {
}

what im experiencing is not a failure but rather the animation wont run on release builds.

gradle cant find textsurface

compile 'com.github.elevenetc:textsurface:0.9.0' cannot be found even after i add the maven repo. can you check ?

java.lang.UnsupportedOperationException

#1838 03-20 17:15:20.929 30309 E AndroidRuntime FATAL EXCEPTION: main
#1839 03-20 17:15:20.929 30309 E AndroidRuntime java.lang.UnsupportedOperationException
#1840 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:446)
#1841 03-20 17:15:20.929 30309 E AndroidRuntime at su.levenetc.android.textsurface.animations.SideCut.clip(SideCut.java:118)
#1842 03-20 17:15:20.929 30309 E AndroidRuntime at su.levenetc.android.textsurface.animations.ShapeReveal.apply(ShapeReveal.java:43)
#1843 03-20 17:15:20.929 30309 E AndroidRuntime at su.levenetc.android.textsurface.Text.onDraw(Text.java:112)
#1844 03-20 17:15:20.929 30309 E AndroidRuntime at su.levenetc.android.textsurface.TextSurface.onDraw(TextSurface.java:88)
#1845 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.View.draw(View.java:11014)
#1846 03-20 17:15:20.929 30309 E AndroidRuntime at android.widget.FrameLayout.draw(FrameLayout.java:450)
#1847 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.View.getDisplayList(View.java:10444)
#1848 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewGroup.drawChild(ViewGroup.java:3167)
#1849 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2793)
#1850 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.View.getDisplayList(View.java:10442)
#1851 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2904)
#1852 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.View.getDisplayList(View.java:10407)
#1853 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2904)
#1854 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.View.getDisplayList(View.java:10407)
#1855 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2904)
#1856 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.View.getDisplayList(View.java:10407)
#1857 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2904)
#1858 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.View.getDisplayList(View.java:10407)
#1859 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:903)
#1860 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewRootImpl.draw(ViewRootImpl.java:2123)
#1861 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1810)
#1862 03-20 17:15:20.929 30309 E AndroidRuntime at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2700)
#1863 03-20 17:15:20.929 30309 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:99)
#1864 03-20 17:15:20.929 30309 E AndroidRuntime at android.os.Looper.loop(Looper.java:156)
#1865 03-20 17:15:20.929 30309 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:5109)
#1866 03-20 17:15:20.929 30309 E AndroidRuntime at java.lang.reflect.Method.invokeNative(Native Method)
#1867 03-20 17:15:20.929 30309 E AndroidRuntime at java.lang.reflect.Method.invoke(Method.java:511)
#1868 03-20 17:15:20.929 30309 E AndroidRuntime at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:991)
#1869 03-20 17:15:20.929 30309 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)
#1870 03-20 17:15:20.929 30309 E AndroidRuntime at dalvik.system.NativeStart.main(Native Method)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.