All Projects → florent37 → Coroutines-Animations

florent37 / Coroutines-Animations

Licence: Apache-2.0 license
Use the power of kotlin coroutines to execute your android animations

Programming Languages

kotlin
9241 projects
shell
77523 projects

Projects that are alternatives of or similar to Coroutines-Animations

Arclayout
With Arc Layout explore new styles and approaches on material design
Stars: ✭ 1,662 (+5261.29%)
Mutual labels:  custom, view
RMGradientView
A Custom Gradient View Control for iOS with inspectable properties.
Stars: ✭ 24 (-22.58%)
Mutual labels:  custom, view
Slidingsquareloaderview
Marvelous sliding square loader view
Stars: ✭ 166 (+435.48%)
Mutual labels:  custom, view
Fiftyshadesof
An elegant context-care loading placeholder for Android
Stars: ✭ 1,110 (+3480.65%)
Mutual labels:  custom, view
LockerScreen
Android lock screen,slide to unlock ! 安卓锁屏,上滑解锁,效果酷炫,值得拥有!
Stars: ✭ 81 (+161.29%)
Mutual labels:  view, animator
Dotsloaderview
Simple dots loader view
Stars: ✭ 63 (+103.23%)
Mutual labels:  custom, view
Transition
Easy interactive interruptible custom ViewController transitions
Stars: ✭ 2,566 (+8177.42%)
Mutual labels:  custom, view
Longshadow
Add a long shadow on any Android View
Stars: ✭ 562 (+1712.9%)
Mutual labels:  custom, view
Uitabbaritem Custombadge
UITabBarItem+CustomBadge is a workaround to change the aspect of IOS UIBadgeView
Stars: ✭ 84 (+170.97%)
Mutual labels:  color, custom
dynamic-utils
Utility functions to perform dynamic operations on Android.
Stars: ✭ 86 (+177.42%)
Mutual labels:  color, view
Viewtooltip
A fluent tooltip for Android
Stars: ✭ 1,029 (+3219.35%)
Mutual labels:  custom, view
Swiftcolorgen
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors
Stars: ✭ 152 (+390.32%)
Mutual labels:  color, alpha
Hhcustomcorner
Awesome library to customize corners of UIView and UIButton. Now you can customize each corner differently
Stars: ✭ 36 (+16.13%)
Mutual labels:  custom, view
Mkloader
Beautiful and smooth custom loading views
Stars: ✭ 1,377 (+4341.94%)
Mutual labels:  custom, view
Mylittlecanvas
🎨Need to create a custom view ? You don't know how to use Canvas, use MyLittleCanvas instead !
Stars: ✭ 870 (+2706.45%)
Mutual labels:  custom, view
Revealbanner
🚀🚀🚀 滑动特效banner
Stars: ✭ 209 (+574.19%)
Mutual labels:  custom, view
Materialimageloading
Material image loading implementation
Stars: ✭ 396 (+1177.42%)
Mutual labels:  custom, view
Lemniscate
An easy way to make your progress view nice and sleek.
Stars: ✭ 420 (+1254.84%)
Mutual labels:  custom, view
Toast
To use it in PCL or .NetStandard projects write this line of code : CrossToastPopUp.Current.ShowToastMessage("Message");
Stars: ✭ 51 (+64.52%)
Mutual labels:  color, custom
Easel
Tint and color Android views with ease
Stars: ✭ 139 (+348.39%)
Mutual labels:  color, view

Coroutines Animations

CircleCI Language

Use the power of kotlin coroutines to execute your android animations

Download

implementation 'com.github.florent37:coroutine-animations:(last version)'

Usage

TOTO : ADD VIDEO

launch(UI) {
    //fire an alpha animation without suspending coroutine
    animation(avatar) { alpha = 0.5f } 
 
    //execute a translation animation
    //use .join() to suspend the coroutine until the animation end
    animation(avatar, startDelay = 1000L) { y = 0f }.join()
 
    //run these animations in parallel
    mutableListOf<Job>(
           animation(follow) {
               top = avatar.y + avatar.height + 16f
           },
           animation(kotlin) {
               left = avatar.x - kotlin.width - 16f
               centerY = avatar.centerY()
           }
    )
    .forEach { it.join() } //wait until all animations have finished
}

Simple animation

animation(view, startDelay= , duration=, interpolator=) { 
    property1 = value1 
    property2 = value1 
}

Custom animation

Animation of Float values

floatAnimation(avatar, from=1f, to=0.5f){ view, value ->
    view.alpha = value
}

Animation of Int values

intAnimation(avatar, from=0, to=300){ view, value ->
    view.x = value
}

Chain Animations

.join() suspend the coroutine until the animation has finished

animation(view1) { property1 = value1 }.join()
animation(view2) { property2 = value2 }.join()

Animations in parallel

Just use animations as usual coroutine jobs, if you want to wait for multiple to finish, add them into a list and call join on each

val animations = mutableListOf<Job>(
    animation(view1) { property1 = value1 }
    animation(view2) { property2 = value2 }
)
animations.forEach { it.join() } // wait for all animations to complete

How to Contribute

We welcome your contributions to this project.

The best way to submit a patch is to send us a pull request.

To report a specific problem or feature request, open a new issue on Github.

Fiches Plateau Moto : https://www.fiches-plateau-moto.fr/

License

Copyright 2018 florent37, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].