Code Monkey home page Code Monkey logo

androidanimationsactions's Introduction

Android Gems

Android Animations Actions

Actions for android animations. Inspired by libgdx scene2d actions.

The main goal of this project is making creating of complex animations easier. You may create animations like in demo with just a couple lines of code.

##Actions sequence - executes actions sequentially
delay - inserts pause into sequence
run - will run target runnable, useful in sequences
parallel - executes actions at the same time
color - color animation for view
scaleTo - scales view to defined values
scaleBy - scales view by defined values
alpha - alpha animation
fadeIn - fades alpha to 1
fadeOut - fades alpha to 0
rotateTo - rotates view to defined degree
rotateBy - rotates view by defined degree
moveTo - moves view to defined x, y
moveBy - moves view by defined x, y
repeat - repeats action using defined number of times
forever - repeats action infinite

play - plays specified action on specified view

##Interpolations Library contains class Interpolations with different predefined interpolations which may be useful for animations.

Demo

For better quality please check package demo in the project.

Gradle

repositories {
    jcenter()
}

dependencies {
    compile 'com.dtx12:actions:0.1.4'
}

androidanimationsactions's People

Contributors

dtx12 avatar liaohuqiu 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

androidanimationsactions's Issues

The view does not go to the "first place" if moveBy reverse value!

This is my code:

    LinearInterpolator interpolator = new LinearInterpolator();
    float width = (float) worldMap[0].getWidth();
    //width = 400;
    float duration = 1f;
    play(forever(sequence(moveBy(-width, 0f, duration, interpolator), moveBy(width, 0f, duration, interpolator))), worldMap[0]);

I am trying to make a loop but The view does not go to the first place, and instead it moves left more than moving to right! So, after few seconds, the view goes out of the screen!
What is wrong here?

Sequence method's parameter is too long

The method can be hard to read when the sequence is very long.
Maybe the API can be changed to Builder pattern, something like

play().sequence().fadeOut().fadeIn(2).on(view)

Crash on adding parallel

    play(forever(parallel(
                    sequence(
                            scaleBy(2f, 2f, 2, Interpolations.QuadraticEaseOut),
                            scaleBy(-2f, -2f),
                            delay(0.2f)
                    ),
                    fadeOut())
    ), radar);

stacktrace:
8-13318/com.justd.startupfabrictest E/AndroidRuntime: Process: com.justd.startupfabrictest, PID: 13318
java.lang.IllegalStateException: target is not specified!
at com.dtx12.android_animations_actions.actions.TypedAction.updateValues(TypedAction.java:68)
at com.dtx12.android_animations_actions.actions.TypedAction.start(TypedAction.java:59)
at android.animation.AnimatorSet.start(AnimatorSet.java:586)
at android.animation.AnimatorSet.start(AnimatorSet.java:586)
at com.dtx12.android_animations_actions.actions.RepeatAction.start(RepeatAction.java:53)
at com.dtx12.android_animations_actions.actions.Actions.play(Actions.java:506)
at com.justd.startupfabrictest.MainActivity.playRadarAnimation(MainActivity.java:69)
at com.justd.startupfabrictest.MainActivity.access$000(MainActivity.java:35)
at com.justd.startupfabrictest.MainActivity$1$1.run(MainActivity.java:130)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

MainActivity 69 is the first line, with play() function

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.