Skip to content

Commit

Permalink
Update Attention
Browse files Browse the repository at this point in the history
  • Loading branch information
gayankuruppu committed Sep 18, 2019
1 parent 2760bdd commit 3e8aa41
Showing 1 changed file with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,47 @@
public class Attention{
public static AnimatorSet Bounce(View view) {
AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "translationY", 0, 0, -30, 0, -15, 0, 0);

animatorSet.playTogether(object1);
return animatorSet;
}

public static AnimatorSet Flash(View view){
AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "alpha", 1, 0, 1, 0, 1);

animatorSet.playTogether(object1);
return animatorSet;
}

public static AnimatorSet Pulse(View view){
AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "scaleY", 1, 1.1f, 1);
ObjectAnimator object2 = ObjectAnimator.ofFloat(view, "scaleX", 1, 1.1f, 1);

animatorSet.playTogether(object1, object2);
return animatorSet;
}

public static AnimatorSet RuberBand(View view){
AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "scaleX", 1, 1.25f, 0.75f, 1.15f, 1);
ObjectAnimator object2 = ObjectAnimator.ofFloat(view, "scaleY", 1, 0.75f, 1.25f, 0.85f, 1);

animatorSet.playTogether(object1, object2);
return animatorSet;
}

public static AnimatorSet Shake(View view){
AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0);

animatorSet.playTogether(object1);
return animatorSet;
}
Expand All @@ -53,4 +63,50 @@ public static AnimatorSet StandUp(View view){
animatorSet.playTogether(object1, object2, object3);
return animatorSet;
}
}

public static AnimatorSet Swing(View view){
AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator object = ObjectAnimator.ofFloat(view, "rotation", 0, 10, -10, 6, -6, 3, -3, 0);
animatorSet.playTogether(object);
return animatorSet;
}

public static AnimatorSet Tada(View view){
AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "scaleX", 1, 0.9f, 0.9f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1);
ObjectAnimator object2 = ObjectAnimator.ofFloat(view, "scaleY", 1, 0.9f, 0.9f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1.1f, 1);
ObjectAnimator object3 = ObjectAnimator.ofFloat(view, "rotation", 0, -3, -3, 3, -3, 3, -3, 3, -3, 0);

animatorSet.playTogether(object1, object2, object3);
return animatorSet;
}

public static AnimatorSet Wave(View view){
AnimatorSet animatorSet = new AnimatorSet();
float x = (view.getWidth() - view.getPaddingLeft() - view.getPaddingRight()) / 2 + view.getPaddingLeft();
float y = view.getHeight() - view.getPaddingBottom();

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "rotation", 12, -12, 3, -3, 0);
ObjectAnimator object2 = ObjectAnimator.ofFloat(view, "pivotX", x, x, x, x, x);
ObjectAnimator object3 = ObjectAnimator.ofFloat(view, "pivotY", y, y, y, y, y);

animatorSet.playTogether(object1, object2, object3);
return animatorSet;
}

public static AnimatorSet Wobble(View view){
AnimatorSet animatorSet = new AnimatorSet();
float width = view.getWidth();
float one = (float) (width / 100.0);

ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "translationX", 0 * one, -25 * one, 20 * one, -15 * one, 10 * one, -5 * one, 0 * one, 0);
ObjectAnimator object2 = ObjectAnimator.ofFloat(view, "rotation", 0, -5, 3, -3, 2, -1, 0);

animatorSet.playTogether(object1, object2);
return animatorSet;
}


}

0 comments on commit 3e8aa41

Please sign in to comment.