All Projects → wisdomtl → Kotlin-Animation-DSL

wisdomtl / Kotlin-Animation-DSL

Licence: other
simplify Android animation code by redefining API, use just one third of code to create animation compare to origin Android API

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Kotlin-Animation-DSL

Sequent
A simple continuous animation library for Android UI.
Stars: ✭ 263 (+484.44%)
Mutual labels:  android-ui, animation-library
Textwriter
Animate your texts like never before
Stars: ✭ 140 (+211.11%)
Mutual labels:  android-ui, animation-library
Materialdialog Android
📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.
Stars: ✭ 602 (+1237.78%)
Mutual labels:  android-ui, animation-library
Textsurface
A little animation framework which could help you to show message in a nice looking way
Stars: ✭ 2,264 (+4931.11%)
Mutual labels:  android-ui, animation-framework
Zoomrecylerlayout
🎢 Zoom Recycler Layout Manager For Android Kotlin
Stars: ✭ 618 (+1273.33%)
Mutual labels:  android-ui, animation-library
media-picker
Easy customizable picker for all your needs in Android application
Stars: ✭ 167 (+271.11%)
Mutual labels:  android-ui, kotlin-android-extensions
ThirdPersonController
Simple 3rd person controller demonstrating camera-relative movement and the new Cinemachine 3rd Person Follow / Aim system
Stars: ✭ 15 (-66.67%)
Mutual labels:  animation-controller
Xama.JTPorts.ShowcaseView
Xamarin.Android Native showcase view.
Stars: ✭ 17 (-62.22%)
Mutual labels:  android-ui
RxLoading
RxJava library for showing a loading (i.e. progress bar) state while waiting for async data with minimal effort and advanced options.
Stars: ✭ 49 (+8.89%)
Mutual labels:  android-ui
TicTacToeUI-Android
Check out the new style for App Design aims for Tic Tac Toe Game...😉😀😁😎
Stars: ✭ 40 (-11.11%)
Mutual labels:  android-ui
transition-hook
☄️ An extremely light-weight react transition animation hook which is simpler and easier to use than react-transition-group
Stars: ✭ 250 (+455.56%)
Mutual labels:  animation-library
SuperToolbar
Android native Toolbar on steroids 💪
Stars: ✭ 52 (+15.56%)
Mutual labels:  android-ui
vector-icons
Free Vector icons for Website and Mobile App
Stars: ✭ 28 (-37.78%)
Mutual labels:  android-ui
Weather
Android自定义View-小米MIUI8天气动画(晴天)
Stars: ✭ 27 (-40%)
Mutual labels:  android-ui
cwac-presentation
CWAC Presentation: Second Screen Support Simplified
Stars: ✭ 106 (+135.56%)
Mutual labels:  android-ui
Android-daily-read-tips
log for articles and info in android for every developer
Stars: ✭ 13 (-71.11%)
Mutual labels:  android-ui
ArcPageIndicator
Android Page Indicator for ViewPager with original animations. It uses an ellipse to dispose indication spots, and can draw a hand, like in old elevators.
Stars: ✭ 73 (+62.22%)
Mutual labels:  android-ui
Storyblok-Android-SDK
Storyblok MP SDK available here: https://github.com/mikepenz/storyblok-mp-SDK
Stars: ✭ 13 (-71.11%)
Mutual labels:  android-ui
Login-SignupUI-FirebasePhoneauth
New Repo
Stars: ✭ 43 (-4.44%)
Mutual labels:  android-ui
ObservableCollections
Observable Collectons for Android Kotlin apps. Observes adds, deletes etc.
Stars: ✭ 19 (-57.78%)
Mutual labels:  kotlin-android-extensions

Kotlin-Animation-DSL

This repository create a series of API to make animation code shorter and more readable, it has the following features:

  1. Using just one third of code to create animation compare to origin Android API.
  2. The code written by Kotlin-Animation-DSL is just like an enghlish article.

Example

If we want to do an animation like the following: scale textView and translate button at the same time, then stretch imageView. in the end of animation, show a toast.

Android style

Using Android origin API, the code will like this:

PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f, 1.3f);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f, 1.3f);
ObjectAnimator tvAnimator = ObjectAnimator.ofPropertyValuesHolder(textView, scaleX, scaleY);
tvAnimator.setDuration(300);
tvAnimator.setInterpolator(new LinearInterpolator());

PropertyValuesHolder translationX = PropertyValuesHolder.ofFloat("translationX", 0f, 100f);
ObjectAnimator btnAnimator = ObjectAnimator.ofPropertyValuesHolder(button, translationX);
btnAnimator.setDuration(300);
btnAnimator.setInterpolator(new LinearInterpolator());

ValueAnimator rightAnimator = ValueAnimator.ofInt(ivRight, screenWidth);
rightAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
        int right = ((int) animation.getAnimatedValue());
        imageView.setRight(right);
    }
});
rightAnimator.setDuration(400);
rightAnimator.setInterpolator(new LinearInterpolator());

AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(tvAnimator).with(btnAnimator);
animatorSet.play(tvAnimator).before(rightAnimator);
animatorSet.addListener(new Animator.AnimatorListener() {
    @Override
    public void onAnimationStart(Animator animation) {}
    @Override
    public void onAnimationEnd(Animator animation) {
        Toast.makeText(activity,"animation end" ,Toast.LENGTH_SHORT).show();
    }
    @Override
    public void onAnimationCancel(Animator animation) {}
    @Override
    public void onAnimationRepeat(Animator animation) {}
});
animatorSet.start();

Too long and unreadable!

DSL style

Let us do it by DSL:

animSet {
    objectAnim {
        target = textView
        scaleX = floatArrayOf(1.0f,1.3f)
        scaleY = scaleX
        duration = 300L
        interpolator = LinearInterpolator()
    } with objectAnim {
        target = button
        translationX = floatArrayOf(0f,100f)
        duration = 300
        interpolator = LinearInterpolator()
    } before anim{
        values = intArrayOf(ivRight,screenWidth)
        action = { value -> imageView.right = value as Int }
        duration = 400
        interpolator = LinearInterpolator()
    }
    onEnd = Toast.makeText(activity,"animation end",Toast.LENGTH_SHORT).show()
    start()
}

The animations' creation and the relationship between them is define in one method.You can use with and before to define the sequence of animations just like speaking english.

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].