Skip to content

Commit a05b196

Browse files
committed
Minor demo improvements
1 parent 71083d5 commit a05b196

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

circulardemo/src/main/java/hu/gordon/circulardemo/fragments/RevealFragment.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ public void onClick(View view) {
6868
// Pre-calculations
6969
//
7070
// get the final radius for the clipping circle
71-
float finalRadius = ViewAnimationUtils.hypo(screenWidth, screenHeight);
71+
72+
int[] myViewLocation = new int[2];
73+
myView.getLocationInWindow(myViewLocation);
74+
75+
float finalRadius = ViewAnimationUtils.hypo(screenWidth-myViewLocation[0], screenHeight-myViewLocation[1]);
7276
int[] center = ViewAnimationUtils.getCenter(fab, myView);
7377

7478
ObjectAnimator animator =

circulardemo/src/main/java/hu/gordon/circulardemo/fragments/TransformFragment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ public void onClick(View view) {
9696
// Pre-calculations
9797
//
9898
// get the final radius for the clipping circle
99-
float finalRadius = ViewAnimationUtils.hypo(screenWidth, screenHeight);
99+
int[] myTargetViewLocation = new int[2];
100+
myTargetView.getLocationInWindow(myTargetViewLocation);
101+
102+
float finalRadius = ViewAnimationUtils.hypo(screenWidth-myTargetViewLocation[0], screenHeight-myTargetViewLocation[1]);
100103
int[] center = ViewAnimationUtils.getCenter(fab, myTargetView);
101104

102105
animator =

0 commit comments

Comments
 (0)