use of android.animation.Animator in project JJSearchViewAnim by android-cjj.
the class JJBaseController method startSearchViewAnim.
public ValueAnimator startSearchViewAnim(float startF, float endF, long time, final PathMeasure pathMeasure) {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(startF, endF);
valueAnimator.setDuration(time);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mPro = (float) valueAnimator.getAnimatedValue();
if (null != pathMeasure)
pathMeasure.getPosTan(mPro, mPos, null);
getSearchView().invalidate();
}
});
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
}
});
if (!valueAnimator.isRunning()) {
valueAnimator.start();
}
mPro = 0;
return valueAnimator;
}
use of android.animation.Animator in project plaid by nickbutcher.
the class DesignerNewsStory method doFabExpand.
private void doFabExpand() {
// translate the chrome placeholder ui so that it is centered on the FAB
int fabCenterX = (fab.getLeft() + fab.getRight()) / 2;
int fabCenterY = ((fab.getTop() + fab.getBottom()) / 2) - fabExpand.getTop();
int translateX = fabCenterX - (fabExpand.getWidth() / 2);
int translateY = fabCenterY - (fabExpand.getHeight() / 2);
fabExpand.setTranslationX(translateX);
fabExpand.setTranslationY(translateY);
// then reveal the placeholder ui, starting from the center & same dimens as fab
fabExpand.setVisibility(View.VISIBLE);
Animator reveal = ViewAnimationUtils.createCircularReveal(fabExpand, fabExpand.getWidth() / 2, fabExpand.getHeight() / 2, fab.getWidth() / 2, (int) Math.hypot(fabExpand.getWidth() / 2, fabExpand.getHeight() / 2)).setDuration(fabExpandDuration);
// translate the placeholder ui back into position along an arc
GravityArcMotion arcMotion = new GravityArcMotion();
arcMotion.setMinimumVerticalAngle(70f);
Path motionPath = arcMotion.getPath(translateX, translateY, 0, 0);
Animator position = ObjectAnimator.ofFloat(fabExpand, View.TRANSLATION_X, View.TRANSLATION_Y, motionPath).setDuration(fabExpandDuration);
// animate from the FAB colour to the placeholder background color
Animator background = ObjectAnimator.ofArgb(fabExpand, ViewUtils.BACKGROUND_COLOR, ContextCompat.getColor(this, R.color.designer_news), ContextCompat.getColor(this, R.color.background_light)).setDuration(fabExpandDuration);
// fade out the fab (rapidly)
Animator fadeOutFab = ObjectAnimator.ofFloat(fab, View.ALPHA, 0f).setDuration(60);
// play 'em all together with the material interpolator
AnimatorSet show = new AnimatorSet();
show.setInterpolator(getFastOutSlowInInterpolator(DesignerNewsStory.this));
show.playTogether(reveal, background, position, fadeOutFab);
show.start();
}
use of android.animation.Animator in project android-demos by novoda.
the class VisibilityController method setVisible.
boolean setVisible(final boolean visible, boolean animated) {
if (isVisible() == visible) {
return false;
}
mVisible = visible;
if (animated) {
float toAlpha = visible ? 1.0f : 0.0f;
ObjectAnimator mAnimator = ObjectAnimator.ofFloat(mView, "Alpha", 1 - toAlpha, toAlpha);
mAnimator.setDuration(mAnimationDuration).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
if (visible) {
setViewVisible(true);
}
}
@Override
public void onAnimationEnd(Animator animator) {
if (!visible) {
setViewVisible(false);
}
}
});
mAnimator.start();
} else {
setViewVisible(visible);
}
return true;
}
use of android.animation.Animator in project weiciyuan by qii.
the class AnimationUtils method createFadeInAnimation.
public static ObjectAnimator createFadeInAnimation(Object target, int duration, final AnimationStartListener listener) {
ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE, VISIBLE);
oa.setDuration(duration).addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
listener.onAnimationStart();
}
@Override
public void onAnimationEnd(Animator animator) {
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
return oa;
}
use of android.animation.Animator in project weiciyuan by qii.
the class AnimationUtils method createFadeOutAnimation.
public static ObjectAnimator createFadeOutAnimation(Object target, int duration, final AnimationEndListener listener) {
ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE);
oa.setDuration(duration).addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
listener.onAnimationEnd();
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
return oa;
}
Aggregations