Circle based animations for Android (min. API 11)

Overview

CircularTools

Circle based animations for Android (min. API 11)

Currently implemented:

Reveal:YouTube Transform:YouTube Radial reaction:YouTube
Reveal DEMO Transform DEMO Radial reaction DEMO

Sample

Demo in the source and releases

Note

Limitations

For reveal and transform:

  • it will never use the native ViewAnimationUtils.createCircularReveal method
  • currently there is an issue: views with elevation cannot be animated correctly on Lollipop and above.
    • workaround A: set the LayerType of the target (or source) view to LayerType.SOFTWARE
    • workaround B: wrap your target or (source) view with a simple layout, without elevation, and animate that. Demo reveal uses this method.
  • hardware acceleration cannot be used in every situation. See table below:
API 11-17 API 18+
Reveal Software Hardware
Transform Software Hardware

For radial reaction

  • only one reaction can be animated at the same time, in the same RadialReactionParent
  • only one layout implemented yet: a LinearLayout.
  • once an affectedView is reached, it will be removed from the list in the RadialReactionParent. If you want to animate multiple times, you have to add the views again. See demo for details.

Usage

For reveal and transform you have to wrap your animated views with a CircularFrameLayout.

<hu.aut.utillib.circular.widget.CircularFrameLayout
        android:id="@+id/simple_reveal"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
    <!-- Put any child views here if you want, it's stock FrameLayout  -->

</hu.aut.utillib.circular.widget.CircularFrameLayout>

Transform:

//myTargetView & mySourceView are children in the CircularFrameLayout
float finalRadius = CircularAnimationUtils.hypo(width, height);

//getCenter computes from 2 view: One is touched, and one will be animated, but you can use anything for center
int[] center = CircularAnimationUtils.getCenter(fab, myTargetView);

animator = CircularAnimationUtils.createCircularTransform(myTargetView, mySourceView, center[0], center[1], 0F, finalRadius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(1500);
animator.start();

Reveal:

//myView is a child in the CircularFrameLayout
float finalRadius = CircularAnimationUtils.hypo(width, height);

//getCenter computes from 2 view: One is touched, and one will be animated, but you can use anything for center
int[] center = CircularAnimationUtils.getCenter(fab, myView);

animator = CircularAnimationUtils.createCircularReveal(myView, center[0], center[1], 0, finalRadius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(1500);
animator.start();      

For radial reaction you have to wrap your views -that are affected by the radial reaction- with a RadialReactionParent.

  • Wrap your view
  • Add a listener to it (this listener will be notified when the invisible circle reaches an affected view)
  • Add views to the parent's watchlist by calling addAffectedView(View v)
  • Create animation and start it
  • Get notified when the radial reaction's invisible circle reaches one of the affected view
<hu.aut.utillib.circular.widget.RadialReactionLinearLayout 
    android:id="@+id/reaction_parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

	<FrameLayout
		android:id="@+id/child_1"
		android:layout_width="80dp"
		android:layout_height="80dp"
		android:layout_alignParentTop="true"
		android:layout_margin="10dp"
		android:background="@color/material_deep_teal_500"
		android:visibility="invisible" />

    <!-- Put any child views here if you want, it's stock LinearLayout -->

</hu.aut.utillib.circular.widget.RadialReactionLinearLayout>

Radial reaction:

reactionParent = (RadialReactionParent) view.findViewById(R.id.reaction_parent);
reactionParent.addListener(this);

//add views
reactionParent.addAffectedView(child1);

ObjectAnimator animator = CircularAnimationUtils.createRadialReaction(reactionParent, fab, "action");
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(1500);
animator.start();

...

    @Override
    public void onRadialReaction(View affectedView, String action) {
	//Do what you want with the view    
    }

How to add dependency

This library is not released in Maven Central, but instead you can use JitPack

add remote maven url

	repositories {
	    maven {
	        url "https://jitpack.io"
	    }
	}

then add a library dependency

	dependencies {
	        compile 'com.github.AutSoft:CircularTools:1.1.0'
	}

License

The MIT License (MIT)

Copyright (c) 2015 AutSoft Kft.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
You might also like...
A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.
A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.

SuperForwardView About A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix. GIF Design Credi

Add Animatable Material Components in Android Jetpack Compose.  Create jetpack compose animations painless.
Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animations painless.

AnimatableCompose Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animation painless. What you can create from M

FragmentTransactionExtended is a library which provide us a set of custom animations between fragments.

FragmentTransactionExtended FragmentTransactionExtended is a library which provide us a set of custom animations between fragments. FragmentTransactio

Combine ViewPager and Animations to provide a simple way to create applications' guide pages.
Combine ViewPager and Animations to provide a simple way to create applications' guide pages.

WoWoViewPager WoWoViewPager combines ViewPager and Animations to provide a simple way to create applications' guide pages. When users are dragging WoW

๐ŸŒ  Transform into a different view or activity using morphing animations.
๐ŸŒ  Transform into a different view or activity using morphing animations.

TransformationLayout ๐ŸŒ  Transform into a different view or activity using morphing animations. Using Transformation motions of new material version. D

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

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

Animations driven by finger movement
Animations driven by finger movement

OffsetAnimator OffsetAnimator lets animate objects basing on touchevents, so users can be engaged in an animation process. Usage Add the library to yo

Group of libraries to help you build better animations with Jetpack Compose
Group of libraries to help you build better animations with Jetpack Compose

Group of libraries to help you build better animations with Jetpack Compose

๐Ÿญ๐Ÿš€๐Ÿ’—  Tutorials about animations with Animators, Animated Vector Drawables, Shared Transitions, and more
๐Ÿญ๐Ÿš€๐Ÿ’— Tutorials about animations with Animators, Animated Vector Drawables, Shared Transitions, and more

๐Ÿญ๐Ÿš€๐Ÿ’— Tutorials about animations with Animators, Animated Vector Drawables, Shared Transitions, and more

Releases(1.1.0)
Owner
AutSoft
Ideas meet technology
AutSoft
[] An Android library which allows developers to easily add animations to ListView items

DEPRECATED ListViewAnimations is deprecated in favor of new RecyclerView solutions. No new development will be taking place, but the existing versions

Niek Haarman 5.6k Dec 30, 2022
Render After Effects animations natively on Android and iOS, Web, and React Native

Lottie for Android, iOS, React Native, Web, and Windows Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations expo

Airbnb 33.5k Jan 4, 2023
Android Transition animations explanation with examples.

UNMAINTAINED No maintainance is intended. The content is still valid as a reference but it won't contain the latest new stuff Android Transition Frame

Luis G. Valle 13.6k Dec 28, 2022
An Android library which provides simple Item animations to RecyclerView items

RecyclerViewItemAnimators Library Travis master: This repo provides: Appearance animations Simple animators for the item views Quick start You can now

Gabriele Mariotti 3.1k Dec 16, 2022
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.

ViewPagerTransforms Library containing common animations needed for transforming ViewPager scrolling on Android v13+. This library is a rewrite of the

Ian Thomas 2.5k Dec 29, 2022
The lib can make the ActivityOptions animations use in Android api3.1+

ActivityOptionsICS ๆœฌ้กน็›ฎๅœๆญข็ปดๆŠค =========== f you are thinking on customizing the animation of Activity transition then probably you would look for Activit

Kale 591 Nov 18, 2022
Android library to create complex multi-state animations.

MultiStateAnimation Android library to create complex multi-state animations. Overview A class that allows for complex multi-state animations using An

Keepsafe 405 Nov 11, 2022
Lightweight Android library for cool activity transition animations

Bungee min SDK 16 (Android Jellybean 4.1) written in Java A lightweight, easy-to-use Android library that provides awesome activity transition animati

Dean Spencer 172 Nov 18, 2022
Repository for android animations Rx wrapper

RxAnimations RxAnimations is a library with the main goal to make android animations more solid and cohesive. Download compile 'oxim.digital:rxanim:

Mihael Francekovic 479 Dec 30, 2022
AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)

AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)

AmirHosseinAghajari 128 Nov 26, 2022