All Projects → graviton57 → Dynamicanimationexample

graviton57 / Dynamicanimationexample

A simple spring animation (support library v25.3.0+) example android app

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Dynamicanimationexample

Plant
Trait-Driven Models of Ecology and Evolution 🌲
Stars: ✭ 39 (-55.68%)
Mutual labels:  dynamic
Dyci Main
Dynamic Code Injection Tool for Objective-C
Stars: ✭ 1,103 (+1153.41%)
Mutual labels:  dynamic
Forge
A Generic Low-Code Framework Built on a Config-Driven Tree Walker
Stars: ✭ 70 (-20.45%)
Mutual labels:  dynamic
Django Access
Django-Access - the application introducing dynamic evaluation-based instance-level (row-level) access rights control for Django
Stars: ✭ 47 (-46.59%)
Mutual labels:  dynamic
Terraform Aws Multi Az Subnets
Terraform module for multi-AZ public and private subnets provisioning
Stars: ✭ 58 (-34.09%)
Mutual labels:  dynamic
Dynamic Datasource Starter
springboot 动态切换数据的基本思想与实现方法
Stars: ✭ 63 (-28.41%)
Mutual labels:  dynamic
Hr4r
Example project - "Hot Reloading 4 RequireJS" front-end web applications & some extra code demonstrating hot-reloading for Node.js Express servers
Stars: ✭ 28 (-68.18%)
Mutual labels:  dynamic
Docker Nginx Image Proxy
on the fly image cropping with gravity, resize and compression microservice
Stars: ✭ 79 (-10.23%)
Mutual labels:  dynamic
Lypaymentfield
多种风格的支付框控件,可定制加密图片,也可使用带动画的弹窗。A variety of styles of payment box controls can be customized to encrypt pictures, can also be used with animated alert.
Stars: ✭ 58 (-34.09%)
Mutual labels:  dynamic
Qigsaw
🔥🔥Qigsaw ['tʃɪɡsɔ] is a dynamic modularization library which is based on Android App Bundles(Do not need Google Play Service). It supports dynamic delivery for split APKs without reinstalling the base one.
Stars: ✭ 1,162 (+1220.45%)
Mutual labels:  dynamic
Atlas
A powerful Android Dynamic Component Framework.
Stars: ✭ 8,028 (+9022.73%)
Mutual labels:  dynamic
Mgs Skinnedmesh
Unity plugin for create flexible hose in scene.
Stars: ✭ 58 (-34.09%)
Mutual labels:  dynamic
Console Based Projects C
All projects are console based💻 and developed using C📚.All projects are dynamic and developed with the concept of Advance data structure 📁(Dynamic memory allocation,Linkedlist,Stack,Queue,Tree)✏️
Stars: ✭ 67 (-23.86%)
Mutual labels:  dynamic
Dynamic Data Source Demo
基于事务的读写分离
Stars: ✭ 43 (-51.14%)
Mutual labels:  dynamic
Fizzygum
a new web framework, an entire platform really, designed from the ground up to handle complex things easily. Put the power of an entire Operating System at your fingertips.
Stars: ✭ 70 (-20.45%)
Mutual labels:  dynamic
Rapidview
RapidView is an android ui and lightapp development framework
Stars: ✭ 951 (+980.68%)
Mutual labels:  dynamic
Horope
Generates dynamic rope setup from spline. c4d python plugin.
Stars: ✭ 61 (-30.68%)
Mutual labels:  dynamic
Reason Loadable
🔥 Suspense/Lazy for ReasonReact.
Stars: ✭ 88 (+0%)
Mutual labels:  dynamic
Cekirdekler
Multi-device OpenCL kernel load balancer and pipeliner API for C#. Uses shared-distributed memory model to keep GPUs updated fast while using same kernel on all devices(for simplicity).
Stars: ✭ 76 (-13.64%)
Mutual labels:  dynamic
Frost Dev
Fast Robot Optimization and Simulation Toolkit (FROST)
Stars: ✭ 67 (-23.86%)
Mutual labels:  dynamic

Dynamic Animation Example

Android Arsenal License API

Dynamic-animation is a new module introduced in revision 25.3.0 of the Android Support Library. It provides a small set of classes for making realistic physics-based view animations.

Setup

To get started, add the following dependency to your module’s build.gradle:

dependencies {
    compile 'com.android.support:support-dynamic-animation:25.3.0'
}

support-dynamic-animation:25.3.0 new physics-based animation library that provides a set of APIs for building animations that dynamically react to user input

Making a SpringAnimation

Well, it won’t really be generic in a programming sense, but let’s start with how every SpringAnimation is made.

  1. Create a SpringAnimation object for your View with a specified ViewProperty
  2. Create a SpringForce object and set your desired parameters (which are described above).
  3. Apply the created SpringForce to your SpringAnimation.
  4. Start the animation.
 private void startSpringAnimation(View view){
        // create an animation for your view and set the property you want to animate
        SpringAnimation animation = new SpringAnimation(view, SpringAnimation.X);
        // create a spring with desired parameters
        SpringForce spring = new SpringForce();
        // can also be passed directly in the constructor
        spring.setFinalPosition(100f);
        // optional, default is STIFFNESS_MEDIUM
        spring.setStiffness(SpringForce.STIFFNESS_LOW); 
        // optional, default is DAMPING_RATIO_MEDIUM_BOUNCY
        spring.setDampingRatio(SpringForce.DAMPING_RATIO_HIGH_BOUNCY);
        // set your animation's spring
        animation.setSpring(spring);
        // animate!
        animation.start();
    }

Preview

alt text

Position

Let’s say we have an arbitrary view positioned in the center of the screen We want to achieve the following behavior:

  1. Drag the view.
  2. Move it around.
  3. Release it.
  4. The view springs back to its original position.

Rotation

There’s a rotating view on our screen which behaves like this:

  1. Grab the view.
  2. Spin it.
  3. Release it.
  4. The view spins back to its original position, again with a bounce.

Scale

As usual, there’s a view on our screen (it could be a photo) which has the following behavior:

  1. Grab it with 2 fingers.
  2. Do a typical pinching gesture to zoom in or out.
  3. Release it.
  4. The view scales back to its original size.

Feel free to fork, contribute and poke at the code.

Developed By

Igor Havrylyuk (Graviton57)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].