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
7
8
- <img src =" http://7sbnrp.com1.z0.glb.clouddn.com/lollipop2-CircularReveal.gif " />
8
+ Currently implemented:
9
+ - Circular reveal
10
+ - Circular transform
9
11
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 >
12
+ Planned:
13
+ - Radial action
14
+
15
+ //TODO gifs
13
16
14
17
Sample
15
18
======
16
- <a href =" https://github.com/ozodrukh/CircularReveal /releases " > Sample & .aar file </a >
19
+ <a href =" https://github.com/Gordi90/CircularTools /releases " > //TODO releases </a >
17
20
18
21
Note
19
- ====
22
+ ======
23
+ - it's a fork from https://github.com/ozodrukh/CircularReveal/
24
+ - independent from Jake Wharton's NineOldsAndroid
25
+ - the returned ` animator ` is an ` ObjectAnimator ` so you can reverse it.
26
+
27
+ Limitations
28
+ ======
29
+ - it will never use the native ` ViewAnimationUtils.createCircularReveal `
30
+ - hardware acceleration cannot be used in every situation. See table below:
20
31
21
- depends from Jake Wharton's NineOldsAndroid, or use my modifed version (included auto cancel)
32
+ | | API 11-17 | API 18-19 | 19+ |
33
+ | -----------| -----------| -----------| ----------|
34
+ | ** Reveal** | Software | Hardware | Software |
35
+ | ** Transform** | Software | Hardware | Hardware |
22
36
23
37
Using
24
38
======
25
39
26
- Use regular ` RevealFrameLayout ` & ` RevealLinearLayout ` don't worry, only target will be clipped :)
40
+ For reveal and transform you have to wrap your animated views with a ` CircularFrameLayout ` .
27
41
28
42
``` 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" >
43
+ <hu .aut.utillib.circular. widget.CircularFrameLayout
44
+ android : id = " @+id/simple_reveal "
45
+ android : layout_width =" match_parent"
46
+ android : layout_height =" match_parent" >
33
47
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
- ```
48
+ <!-- Put any child views here if you want, it's stock frame layout -->
54
49
50
+ </hu .aut.utillib.circular.widget.CircularFrameLayout>
51
+ ```
52
+ ** Transform:**
55
53
``` java
54
+ // myTargetView & mySourceView are children in the CircularFrameLayout
55
+ float finalRadius = ViewAnimationUtils . hypo(width, height);
56
56
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 ;
57
+ // getCenter computes from 2 view: One is touched, and one will be animated, but you can use anything for center
58
+ int [] center = ViewAnimationUtils . getCenter(fab, myTargetView);
62
59
63
- // get the final radius for the clipping circle
64
- int finalRadius = Math . max(myView. getWidth(), myView. getHeight());
65
-
66
- SupportAnimator animator =
67
- ViewAnimationUtils . createCircularReveal(myView, cx, cy, 0 , finalRadius);
68
- animator. setInterpolator(new AccelerateDecelerateInterpolator ());
69
- animator. setDuration(1500 );
70
- animator. start();
60
+ animator = ViewAnimationUtils . createCircularTransform(myTargetView, mySourceView, center[0 ], center[1 ], 0F , finalRadius);
61
+ animator. setInterpolator(new AccelerateDecelerateInterpolator ());
62
+ animator. setDuration(1500 );
63
+ animator. start();
71
64
72
65
```
73
66
74
- ####API that need to mention
75
-
76
- #####Cancel it!
77
-
67
+ ** Reveal:**
78
68
``` java
69
+ // myView is a child in the CircularFrameLayout
70
+ float finalRadius = ViewAnimationUtils . hypo(width, height);
79
71
80
- SupportAnimator animator = ... ;
81
- animator. cancel();
82
-
83
- ```
84
-
85
- #####Reverse it!
86
-
87
- ``` java
72
+ // getCenter computes from 2 view: One is touched, and one will be animated, but you can use anything for center
73
+ int [] center = ViewAnimationUtils . getCenter(fab, myView);
88
74
89
- SupportAnimator animator = ... ;
90
- animator = animator. reverse(); // override with new one
75
+ animator = ViewAnimationUtils . createCircularReveal(myView, center[0 ], center[1 ], 0 , finalRadius);
76
+ animator. setInterpolator(new AccelerateDecelerateInterpolator ());
77
+ animator. setDuration(1500 );
78
+ animator. start();
91
79
92
80
```
93
81
@@ -110,7 +98,7 @@ then add a library dependency
110
98
111
99
``` groovy
112
100
dependencies {
113
- compile 'com.github.ozodrukh:CircularReveal:1.1.0@aar '
101
+ compile '//TODO '
114
102
}
115
103
```
116
104
@@ -120,7 +108,7 @@ License
120
108
121
109
The MIT License (MIT)
122
110
123
- Copyright (c) 2014 Abdullaev Ozodrukh
111
+ Copyright (c) 2015 AutSoft Kft.
124
112
125
113
Permission is hereby granted, free of charge, to any person obtaining a copy
126
114
of this software and associated documentation files (the "Software"), to deal
0 commit comments