Giter Site home page Giter Site logo

gouravd / quicksand Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blundell/quicksand

0.0 1.0 0.0 8.73 MB

Automatically manipulates the duration of animations dependent on view count. Quicksand .. the more you struggle.

License: Other

Java 100.00%

quicksand's Introduction

QuickSand

When showing a really enchanting explanatory animation to your users, but you know that after a while it'll get tedious and would stop users wanting to use your app. QuickSand is here to solve that problem.

Automatically manipulates the duration of animations depending on how many times the user has viewed them.

Simple Use

This is the setup needed to define how you change the animation duration between views:

Map<String, ViscosityInterpolator> modifiers = new HashMap<>();
modifiers.put("MyAnimationSetKey", TwoStepViscosityInterpolator.defaultInstance());
Quicksand.create(this, modifiers);

This is "trapping" an animation, meaning when this view is animated Quicksand will determine how many times it has been viewed and vary the animation duration according to the ViscosityInterpolator set above:

View myView = findViewById(R.id.my_view);
QuickSand.trap("MyAnimationSetKey", myView);
myView.animate().alpha();

Also works for multiple view animation:

 View myView = findViewById(R.id.my_view);
 View myOtherView = findViewById(R.id.my_view);
 View myThirdView = findViewById(R.id.my_view);
 QuickSand.trap("MyAnimationSetKey", myView, myOtherView, myThirdView);
 myView.animate().alpha();
 myOtherView.animate().alpha();
 myThirdView.animate().alpha();

Some viscosities already defined see the code here:

  • AllOrNothing - you can run your animation for X seconds X times and then 0 seconds after that
  • LinearChange - speed up the animation each time it is viewed until X views
  • TwoStep - run animation at X speed for X times then it will run at half X

See the demo project for more examples.

Adding to your project

dependencies {
    compile 'com.blundell:quicksand:1.0.2'
}

See it to believe it

15 second gif below
Notice how the animation duration decreases each time it is ran until eventually it does not animate (only touch feedback), Quicksand integration is done with 2 lines of code.
demo

Download

Release Notes Get the latest version here

License

Apache 2

quicksand's People

Contributors

blundell avatar

Watchers

das_vicky avatar

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.