• Stars
    star
    247
  • Rank 164,117 (Top 4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated over 4 years ago

Reviews

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

Repository Details

for a better Android Experience

About

MonitorUI Example Scroller Example View Prototype

中文说明

Animer is a java library which designed for a better Android animation experience.(Currently is more like a view animation controller)

It contains animation curves in Android iOS Origami(POP or Rebound in Client) Principle Protopie FramerJS

Unlike Rebound,Animer didn't use Choreographer or self-building Looper for creating an Animator from scratch.

All these animation algorithm will be translated into Android's native implementation like DynamicAnimation & TimingInterpolator,which can improve the performance of animation.

It also provides a real-time controller & graph UI for tweaking parameters.

Web version(Convert Any Animation tools' parameters to Android's) —— Animer_Web

AE Script —— Animer AE

Download

Download

Simple Demo 1

Simple Demo 2

Usage

Animer supports multiple ways of animating:

Android Native Style

  
// equal to Android's TimingInterpolator
Animer.AnimerSolver solver  = Animer.interpolatorDroid(new AccelerateDecelerateInterpolator(),600)

// similar to ObjectAnimator 
Animer animer = new Animer(myView,solver,Animer.TRANSLATION_Y,0,200);

animer.start();

// animer.cancel();

// animer.end();

FramerJS State Machine Style

// equal to Android's SpringAnimation
Animer.AnimerSolver solver  = Animer.springDroid(1000,0.5f);

Animer animer = new Animer();

// add a solver to Animer; 
animer.setSolver(solver);

// add value to different state;
animer.setStateValue("stateA",300);
animer.setStateValue("stateB",700);
animer.setStateValue("stateC",200);

// add a listener to observe the motion of the Animation
animer.setUpdateListener(new Animer.UpdateListener() {
    @Override
    public void onUpdate(float value, float velocity, float progress) {
      myView1.setTranslationX(value);
      myView2.setScaleX(1.f+value/100);
      myView2.setScaleY(1.f+value/100);
    }
});

// switch immediately
animer.switchToState("stateA");

// or animate to state value
// animer.animateToState("stateB");

Facebook Rebound Style

// equal to Facebook Origami POP Animation
Animer.AnimerSolver solver  = Animer.springOrigamiPOP(5,10);

Animer animer = new Animer(myView,solver,Animer.SCALE);

// setup a listener to add everything you want
animer.setUpdateListener(new Animer.UpdateListener() {
    @Override
    public void onUpdate(float value, float velocity, float progress) 
      myView.setScaleX(value);
      myView.setScaleY(value);
    }
});

animer.setCurrentValue(1.f);

boolean isScaled = false;

myView.setOnClickListener(view -> {

    if(!isScaled){
        animer.setEndValue(0.5);

    }
    else{
        animer.setEndValue(1);
    }
    isScaled = !isScaled;
});
  

Add animers to configUI

init in xml

<com.martinrgb.animer.monitor.AnConfigView
    android:id="@+id/an_configurator"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

add animers' config in java

AnConfigView mAnimerConfiguratorView = (AnConfigView) findViewById(R.id.an_configurator);
AnConfigRegistry.getInstance().addAnimer("Card Scale Animation",cardScaleAnimer);
AnConfigRegistry.getInstance().addAnimer("Card TranslationX Animation",cardTransXAnimer);
mAnimerConfiguratorView.refreshAnimerConfigs();

Add custom animation curve presets

first you need clean all the solver configs,then add yourselves.

AnConfigRegistry.getInstance().removeAllSolverConfig();
AnConfigRegistry.getInstance().addSolver("Preset1",Animer.springDroid(500.0f,0.96f));
AnConfigRegistry.getInstance().addSolver("Preset2",Animer.flingDroid(400.f,0.95f));
...
mAnimerConfiguratorView.refreshAnimerConfigs();

Supported View Propertys:

Animer.TRANSLATION_X
Animer.TRANSLATION_Y
Animer.TRANSLATION_Z
Animer.SCALE // equal to SCALE_X + SCALE_Y
Animer.SCALE_X
Animer.SCALE_Y
Animer.ROTATION
Animer.ROTATION_X
Animer.ROTATION_Y
Animer.X
Animer.Y
Animer.Z
Animer.ALPHA

Supported Animators(as AnimerSolver):

Animer.springDroid(stiffness,dampingratio)                              // Android Dynamic SpringAnimation
Animer.flingDroid(velocity,friction)                                    // Android Dynamic FlingAnimation
Animer.springiOSUIView(dampingratio,duration)                           // iOS UIView SPring
Animer.springiOSCoreAnimation(stiffness,damping)                        // iOS CASpringAnimation
Animer.springOrigamiPOP(bounciness,speed)                               // Origami POP
Animer.springRK4(tension,friction)                                      // Framer-RK4
Animer.springDHO(stiffness,damping)                                     // Framer-DHO
Animer.springProtopie(tension,friction)                                 // Protopie
Animer.springPrinciple(tension,friction)                                // Principle

// Custom Bounce Interpolator(Romain Guy's DropInMotion)
Animer.interpolatorDroid(new CustomBounceInterpolator(),duration)       

// Custom Damping Interpolator(Romain Guy's DropInMotion)
Animer.interpolatorDroid(new CustomDampingInterpolator(),duration)      

// MocosSpring Interpolator (https://github.com/marcioapaiva/mocos-controlator)
Animer.interpolatorDroid(new CustomMocosSpringInterpolator(),duration)  

// Custom Spring Interpolator(https://inloop.github.io/interpolator/)
Animer.interpolatorDroid(new CustomSpringInterpolator(),duration)       

// Android Native Interpolator Below
Animer.interpolatorDroid(new PathInterpolator(),duration)               // Cubic Bezier Interpolator
...
Animer.interpolatorDroid(new DecelerateInterpolator(),duration)         // Android Decelerate Interpolator
...

TODO

  • A State Machine which can control interface's state(current is only object propertyValue's state)
  • Redesign the API
  • Rewrite the glsl shader
  • Consider scences in activity/fragment transition
  • Hook mechanism
  • Redesign the ConfigUI,it's difficult to tweak paras in small screen,maybe consider 'adb+electron in desktop client'

Core concpet:

Data

  • State machine concpet from FramerJS ✅
  • Aniamtion converter from my Animation Converter ✅
  • Support external JSON to edit animation data

Althogrim

  • Physics animation concept from Rebound & Android DynamicAnimation ✅
  • LookupTable Interpolation Animator + RK4 Solver + DHO Solver ✅
  • Physics simulation from Flutter Physics & UIKit Dyanmic
  • Momentum
  • Calculating mass by Elements' area
  • Limit SpringAnimation's by time or overshoot counts

Advanced Animation Setting

  • Addtive animation (compose mulitple animation)
  • Chained animation (one by one)
  • Parallax animation (same duration but differnt transition)
  • Sequencing animation (same transition but different startDelay)

User-Control

  • Gesture-Driven animation,you can interact with the animation even it is animating(Like iOS's CADisplayLink Or Rebound's SetEndValue) ✅
  • Package a gesture animator for interactive animation,attach gesture's velocity to animation system,make a flawess experience.
  • Easy2use animation listener for controlling other element when the object is interacting or animating ✅

Performance

  • Use android framework native DyanmicAniamtion And TimingInterpolator ✅
  • Pre-save animation's data for less calculation
  • Hardware Acceleration ✅

Design Component

  • Scrollview|Scroller|PageViewer Component & Example
  • Drag | DND Component & Example
  • Button Component & Example
  • Transition Component & Example(Maintain different element's property in state machine)
  • Scroll-selector Component & Example(Scroll to fixed position)
  • Swipe to delete Component & Example

Dev Tools

  • Data-bind graph to modify and preview animation in application ✅
  • Data-bind selctor to change animation-type in application ✅(Still has some bugs)

Utils

  • AE Plugin for converting curves & revealing codes ✅(Will update GUI later)

License

See Apache License here

More Repositories

1

Replace-iOS

Simply Implement Zee Young's animation
Objective-C
1,081
star
2

GiftCard-Android

Simply Implement Dribbble's popular shot
Java
850
star
3

MTMaterialDelete

a simple implement of my workmate's animation
Objective-C
816
star
4

MTSwift-Learning

Begin to learn swift,try to make some simple project here(DEPRECATED)
Swift
750
star
5

LearnCube-iOS

An animation practise demo
Objective-C
628
star
6

GiftCard-iOS

Simply Implement dribbble's popular shot.
Objective-C
544
star
7

RapidInterpolator

Realtime interpolator editor(Inspired by Facebook Rebound)
Java
396
star
8

MTPrivateTrainerAnimation

A simple implement of my design(DEPRECATED)
Swift
281
star
9

MTGuideline

Some Design Guideline I made.
161
star
10

Animer_Web

website for iOS/Web/Android Native Animation curve visualizing and para converting
JavaScript
148
star
11

MTMusicPlayer

simple implement an AV Player & my workmates Animation(DEPRECATED)
Swift
138
star
12

sketch-smooth-corner-android

A android project explained how to draw sketch smooth corner in android canvas
Java
76
star
13

Figma_Squircles_Approximation

JavaScript
52
star
14

GLES30_ProgrammingGuide_NDK

C with NDK Android GLES Tutorial,forked from https://github.com/danginsburg/opengles3-book
Makefile
43
star
15

TweakIt-Desktop

An Android Debugging Application
JavaScript
38
star
16

upng_tools_for_colleague

Try to build a local application for http://upng.photopea.com/
JavaScript
33
star
17

Droidcon_Shanghai_Keynote

Keynote I used in Droidcon Shanghai
22
star
18

MI_Style_Multitask_Prototype

A prototype simply explained how to make Xiaomi Style Multitask Interaction
Java
21
star
19

LTC_AreaLight_R3F_Component

TypeScript
18
star
20

iOS17_Namedrop_R3F

TypeScript
17
star
21

blog

GL&Anim blog environment
17
star
22

MartinRGB.github.io

My Personal Website
HTML
15
star
23

Material-Motion-Chinese

Material Motion 的在线翻译版本
JavaScript
13
star
24

android-prototype-learning

AndroidPrototypeLearning is my playground for android learning & rapid prototype
Java
11
star
25

Unity3dAndroidLiveWallpaper

Java
11
star
26

Animer_AE

Android/iOS/Web Native Animation Parameters in AE
JavaScript
9
star
27

ThinkingAboutSpring

An exercise
Java
7
star
28

blog_deprecated

My blog,powered by Hexo
6
star
29

sketch-smooth-corner-web

A web project explained how to draw sketch smooth corner in web
JavaScript
6
star
30

stable_fluid_r3f

React Three Fiber Version
TypeScript
5
star
31

FBM_Effect_Optimization_Note

gpu-based effect optimization
4
star
32

30ProjectsOfBlender

I'm Learning Blender for 3D Coding(Unity/Three.js).By learning the theory behind these effect,I can understand how to code interactive effect.
3
star
33

raymarching_sphere_r3f

TypeScript
3
star
34

IBM-Moiton-Chinese

IBM Motion Guideline 的在线翻译版本
JavaScript
3
star
35

AnimatorList_AE

JavaScript
3
star
36

martinrgb

2
star
37

OpenGL_SuperBible_5th_macOS

get a environment of opengl learning(tutorial from spweau_me)
C
2
star
38

travis_avd_previewer_android

Java
2
star
39

android_fourcolor_gradient_forAE

Java
2
star
40

android_frameless_webview_wrapper

An Android app for preview Web-based rapid protoype
JavaScript
2
star
41

UIAnimationTool_Web

A tool for animation design in GUI
JavaScript
2
star
42

android_camera_experiment

Camera Experiment:Face Detection,Take Pictures,Capture Video.
Java
2
star
43

MAKA_H5_Album_Project

HTML
1
star
44

Z490UD-11900K-6600XT-Ventura-Hackintosh

1
star
45

Renderscript_LUT_Filter_Template

Java
1
star
46

100ProjectsVulkan

先立个 Flag
C++
1
star
47

OpenGLES20_Game_Dev

a repo for learning tutorials
Java
1
star
48

Docker-Https-Seafile-Template

Python
1
star
49

AndroidFlingScrollView_AE

an AE project explained How to use FlingAnimation to decay the speed of listview
1
star
50

UniversalGlass_R3F_Component

an UniversersalGlass React Three Fiber component that contains refraction,reflection,blur properties
TypeScript
1
star
51

RaspberryPi-CM4-eGPU-Guide

C
1
star