1
- CircularTransform
2
- based on https://github.com/ozodrukh/CircularReveal
3
- Readme and code is under development.
1
+ CircularTools
4
2
==============
5
3
6
- Lollipop ViewAnimationUtils.createCircularReveal for everyone 2.3+
4
+ Readme and code is under development.
5
+
6
+ Circle based animations for Android (min. API 11)
7
+
8
+ Currently implemented:
9
+ - Circular reveal
10
+ - Circular transform
11
+
12
+ Planned:
13
+ - Radial action
14
+
15
+ ** Reveal:**
16
+ <a href =" https://youtu.be/g83nwbi33c0 " >YouTube</a >
7
17
8
- <img src =" http://7sbnrp.com1.z0.glb.clouddn.com/lollipop2-CircularReveal.gif " />
18
+ <img src =" http://i.imgur.com/pT0UqHA.gif " alt =" Reveal DEMO " width =" 240 " height =" 400 " border =" 10 " />
19
+
20
+ ** Transform:**
21
+ <a href =" https://youtu.be/96eBHwWxTiA " >YouTube</a >
22
+
23
+ <img src =" http://i.imgur.com/QeaoLpD.gif " alt =" Transform DEMO " width =" 240 " height =" 400 " border =" 10 " />
9
24
10
- <a href="http://www.youtube.com/watch?feature=player_embedded&v=_vVpwzYb4Dg
11
- " target="_ blank">Yotube Video <br /> <img src="http://img.youtube.com/vi/_vVpwzYb4Dg/0.jpg "
12
- alt="Ripple DEMO" width="320" height="240" border="10" /></a >
13
25
14
26
Sample
15
27
======
16
- <a href =" https://github.com/ozodrukh/CircularReveal /releases " > Sample & .aar file </a >
28
+ <a href =" https://github.com/Gordi90/CircularTools /releases " > //TODO releases </a >
17
29
18
30
Note
19
- ====
31
+ ======
32
+ - it's a fork from https://github.com/ozodrukh/CircularReveal/
33
+ - independent from Jake Wharton's NineOldsAndroid
34
+ - the returned ` animator ` is an ` ObjectAnimator ` so you can reverse it.
35
+
36
+ Limitations
37
+ ======
38
+ - it will never use the native ` ViewAnimationUtils.createCircularReveal ` method
39
+ - hardware acceleration cannot be used in every situation. See table below:
20
40
21
- depends from Jake Wharton's NineOldsAndroid, or use my modifed version (included auto cancel)
41
+ | | API 11-17 | API 18-19 | 19+ |
42
+ | -----------| -----------| -----------| ----------|
43
+ | ** Reveal** | Software | Hardware | Software |
44
+ | ** Transform** | Software | Hardware | Hardware |
22
45
23
46
Using
24
47
======
25
48
26
- Use regular ` RevealFrameLayout ` & ` RevealLinearLayout ` don't worry, only target will be clipped :)
49
+ For reveal and transform you have to wrap your animated views with a ` CircularFrameLayout ` .
27
50
28
51
``` xml
29
- <io .codetail. widget.RevealFrameLayout
30
- xmlns : android = " http://schemas.android.com/apk/res/android "
31
- android : layout_width =" match_parent"
32
- android : layout_height =" match_parent" >
52
+ <hu .aut.utillib.circular. widget.CircularFrameLayout
53
+ android : id = " @+id/simple_reveal "
54
+ android : layout_width =" match_parent"
55
+ android : layout_height =" match_parent" >
33
56
34
- <!-- Put more views here if you want, it's stock frame layout -->
35
-
36
- <android .support.v7.widget.CardView
37
- xmlns : app =" http://schemas.android.com/apk/res-auto"
38
- android : id =" @+id/awesome_card"
39
- style =" @style/CardView"
40
- app : cardBackgroundColor =" @color/material_deep_teal_500"
41
- app : cardElevation =" 2dp"
42
- app : cardPreventCornerOverlap =" false"
43
- app : cardUseCompatPadding =" true"
44
- android : layout_marginLeft =" 8dp"
45
- android : layout_marginRight =" 8dp"
46
- android : layout_marginTop =" 8dp"
47
- android : layout_width =" 300dp"
48
- android : layout_height =" 300dp"
49
- android : layout_gravity =" center_horizontal"
50
- />
51
-
52
- </io .codetail.widget.RevealFrameLayout>
53
- ```
57
+ <!-- Put any child views here if you want, it's stock frame layout -->
54
58
59
+ </hu .aut.utillib.circular.widget.CircularFrameLayout>
60
+ ```
61
+ ** Transform:**
55
62
``` java
63
+ // myTargetView & mySourceView are children in the CircularFrameLayout
64
+ float finalRadius = CircularAnimationUtils . hypo(width, height);
56
65
57
- View myView = findView(R . id. awesome_card);
58
-
59
- // get the center for the clipping circle
60
- int cx = (myView. getLeft() + myView. getRight()) / 2 ;
61
- int cy = (myView. getTop() + myView. getBottom()) / 2 ;
62
-
63
- // get the final radius for the clipping circle
64
- int finalRadius = Math . max(myView. getWidth(), myView. getHeight());
66
+ // getCenter computes from 2 view: One is touched, and one will be animated, but you can use anything for center
67
+ int [] center = CircularAnimationUtils . getCenter(fab, myTargetView);
65
68
66
- SupportAnimator animator =
67
- ViewAnimationUtils . createCircularReveal(myView, cx, cy, 0 , finalRadius);
68
- animator. setInterpolator(new AccelerateDecelerateInterpolator ());
69
- animator. setDuration(1500 );
70
- animator. start();
69
+ animator = CircularAnimationUtils . createCircularTransform(myTargetView, mySourceView, center[0 ], center[1 ], 0F , finalRadius);
70
+ animator. setInterpolator(new AccelerateDecelerateInterpolator ());
71
+ animator. setDuration(1500 );
72
+ animator. start();
71
73
72
74
```
73
75
74
- ####API that need to mention
75
-
76
- #####Cancel it!
77
-
76
+ ** Reveal:**
78
77
``` java
78
+ // myView is a child in the CircularFrameLayout
79
+ float finalRadius = CircularAnimationUtils . hypo(width, height);
79
80
80
- SupportAnimator animator = ... ;
81
- animator. cancel();
82
-
83
- ```
84
-
85
- #####Reverse it!
86
-
87
- ``` java
81
+ // getCenter computes from 2 view: One is touched, and one will be animated, but you can use anything for center
82
+ int [] center = CircularAnimationUtils . getCenter(fab, myView);
88
83
89
- SupportAnimator animator = ... ;
90
- animator = animator. reverse(); // override with new one
84
+ animator = CircularAnimationUtils . createCircularReveal(myView, center[0 ], center[1 ], 0 , finalRadius);
85
+ animator. setInterpolator(new AccelerateDecelerateInterpolator ());
86
+ animator. setDuration(1500 );
87
+ animator. start();
91
88
92
89
```
93
90
@@ -110,7 +107,7 @@ then add a library dependency
110
107
111
108
``` groovy
112
109
dependencies {
113
- compile 'com.github.ozodrukh:CircularReveal:1.1.0@aar '
110
+ compile '//TODO '
114
111
}
115
112
```
116
113
@@ -120,7 +117,7 @@ License
120
117
121
118
The MIT License (MIT)
122
119
123
- Copyright (c) 2014 Abdullaev Ozodrukh
120
+ Copyright (c) 2015 AutSoft Kft.
124
121
125
122
Permission is hereby granted, free of charge, to any person obtaining a copy
126
123
of this software and associated documentation files (the "Software"), to deal
0 commit comments