本文整理汇总了Java中android.animation.Animator.start方法的典型用法代码示例。如果您正苦于以下问题:Java Animator.start方法的具体用法?Java Animator.start怎么用?Java Animator.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.Animator
的用法示例。
在下文中一共展示了Animator.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performCircularReveal
import android.animation.Animator; //导入方法依赖的package包/类
private void performCircularReveal(View show) {
show.setBackgroundColor(0xffff0000);
ViewCompat.setTranslationY(show, 0);
ViewCompat.setTranslationX(show, 0);
show.getLayoutParams().height = 500;
show.getLayoutParams().width = 1920;
show.requestLayout();
int centerX = (show.getLeft() + show.getRight()) / 2;
int centerY = (show.getTop() + show.getBottom()) / 2;
float finalRadius = (float) Math.hypot((double) centerX, (double) centerY);
Animator mCircularReveal = ViewAnimationUtils.createCircularReveal(
show, centerX, centerY, 0, finalRadius);
mCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
mCircularReveal.setDuration(500);
mCircularReveal.start();
}
示例2: reveal
import android.animation.Animator; //导入方法依赖的package包/类
public void reveal (float positionFromRight, int animationDuration) {
View revealingView = circularRevealViewContainer.getChildAt(0);
// start x-index for circular animation
int cx = revealingView.getWidth() - (int) (positionFromRight);
// start y-index for circular animation
int cy = (revealingView.getTop() + revealingView.getBottom()) / 2;
// calculate max radius
int dx = Math.max(cx, revealingView.getWidth() - cx);
int dy = Math.max(cy, revealingView.getHeight() - cy);
float finalRadius = (float) Math.hypot(dx, dy);
// Circular animation declaration begin
final Animator animator;
animator = io.codetail.animation.ViewAnimationUtils
.createCircularReveal(revealingView, cx, cy, 0, finalRadius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(animationDuration);
revealingView.setVisibility(View.VISIBLE);
animator.start();
}
示例3: show
import android.animation.Animator; //导入方法依赖的package包/类
/**
* 向四周伸张,直到完成显示。
*/
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
myView.setVisibility(View.VISIBLE);
return;
}
int cx = (myView.getLeft() + myView.getRight()) / 2;
int cy = (myView.getTop() + myView.getBottom()) / 2;
int w = myView.getWidth();
int h = myView.getHeight();
// 勾股定理 & 进一法
int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;
Animator anim =
ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
myView.setVisibility(View.VISIBLE);
anim.setDuration(durationMills);
anim.start();
}
示例4: animateDragViewToOriginalPosition
import android.animation.Animator; //导入方法依赖的package包/类
private void animateDragViewToOriginalPosition() {
if (mDragView != null) {
Animator anim = new LauncherViewPropertyAnimator(mDragView)
.translationX(0)
.translationY(0)
.scaleX(1)
.scaleY(1)
.setDuration(REORDERING_DROP_REPOSITION_DURATION);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onPostReorderingAnimationCompleted();
}
});
anim.start();
}
}
示例5: doCircularReveal
import android.animation.Animator; //导入方法依赖的package包/类
private void doCircularReveal() {
int centerX = (movieBackdrop.getLeft() + movieBackdrop.getRight()) / 2;
int centerY = movieBackdrop.getTop();
int startRadius = 0;
int endRadius = Math.max(movieBackdrop.getWidth(), movieBackdrop.getHeight());
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Animator animator = ViewAnimationUtils
.createCircularReveal(movieBackdrop, centerX, centerY, startRadius, endRadius);
animator.setDuration(500);
movieBackdrop.setVisibility(View.VISIBLE);
animator.start();
} else {
movieBackdrop.setVisibility(View.VISIBLE);
}
}
示例6: exitReveal
import android.animation.Animator; //导入方法依赖的package包/类
private void exitReveal(final View icon, final View toolbar) {
// get the center for the clipping circle
int cx = getRelativeLeft(icon) + icon.getMeasuredWidth() / 2;
int cy = getRelativeTop(icon);
// get the initial radius for the clipping circle
int initialRadius = Math.max(toolbar.getWidth(), toolbar.getHeight());
// create the animation (the final radius is zero)
Animator anim =
ViewAnimationUtils.createCircularReveal(toolbar, cx, cy, initialRadius, 0);
// make the view invisible when the animation is done
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
toolbar.setVisibility(View.INVISIBLE);
}
});
anim.setDuration(Constant.SEARCH_REVEAL_DURATION);
// start the animation
anim.start();
}
示例7: addIndicator
import android.animation.Animator; //导入方法依赖的package包/类
private void addIndicator(@DrawableRes int backgroundDrawableId, Animator animator) {
if (animator.isRunning()) animator.end();
View Indicator = new View(getContext());
Indicator.setBackgroundResource(backgroundDrawableId);
addView(Indicator, mIndicatorWidth, mIndicatorHeight);
LayoutParams lp = (LayoutParams) Indicator.getLayoutParams();
lp.leftMargin = mIndicatorMargin;
lp.rightMargin = mIndicatorMargin;
Indicator.setLayoutParams(lp);
animator.setTarget(Indicator);
animator.start();
}
示例8: animateWindowInCircular
import android.animation.Animator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateWindowInCircular(@Nullable View anchor, @NonNull View contentView) {
Pair<Integer, Integer> coordinates = getClickOrigin(anchor, contentView);
Animator animator = ViewAnimationUtils.createCircularReveal(contentView,
coordinates.first,
coordinates.second,
0,
Math.max(contentView.getWidth(), contentView.getHeight()));
animator.setDuration(ANIMATION_DURATION);
animator.start();
}
示例9: animateButton
import android.animation.Animator; //导入方法依赖的package包/类
private void animateButton() {
/* Circular reveal the button */
int startRadius = 0;
int finalRadius = Math.max(maskView.getHeight(), maskView.getWidth());
final Animator anim = ViewAnimationUtils.createCircularReveal(maskView,
maskView.getRight(),
maskView.getHeight() / 2
, startRadius, finalRadius);
maskView.setVisibility(View.VISIBLE);
anim.setInterpolator(new FastOutSlowInInterpolator());
anim.setDuration(800);
anim.start();
// set the button text2+
buttonText.setText(R.string.continue_btn_text);
/* Animate the check image */
ObjectAnimator rotationAnimator = ObjectAnimator.ofFloat(checkImage, "rotation", 0f, 360f);
rotationAnimator.setDuration(400);
rotationAnimator.setInterpolator(new FastOutSlowInInterpolator());
int center = maskView.getRight() / 2;
int right = maskView.getRight();
int offSet = (right - center) / 2;
ObjectAnimator translateXInterpolator = ObjectAnimator.ofFloat(checkImage, "x", offSet + 10f);
translateXInterpolator.setDuration(400);
translateXInterpolator.setInterpolator(new DecelerateInterpolator());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(rotationAnimator, translateXInterpolator);
animatorSet.start();
// for second time
count++;
}
示例10: hideCircularReveal
import android.animation.Animator; //导入方法依赖的package包/类
public static void hideCircularReveal(final Context context,
final View view,
final RevealAnimationSetting revealSettings,
final int startColor,
final int endColor,
final Dismissible.OnDismissedListener listener) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int cx = revealSettings.getCenterX();
int cy = revealSettings.getCenterY();
int width = revealSettings.getWidth();
int height = revealSettings.getHeight();
int duration =
context.getResources().getInteger(android.R.integer.config_mediumAnimTime);
float initRadius = (float) Math.sqrt(width * width + height * height);
Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initRadius, 0);
anim.setDuration(duration);
anim.setInterpolator(new FastOutSlowInInterpolator());
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
listener.onDismissed();
}
});
anim.start();
recolorBackground(view, startColor, endColor, duration);
} else {
listener.onDismissed();
}
}
示例11: animateAppear
import android.animation.Animator; //导入方法依赖的package包/类
private void animateAppear() {
final Animator appearAnimator = animatorFactory.createAppearAnimator(presentView);
appearAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
sharePickerView.setVisibility(GONE);
}
});
appearAnimator.start();
}
示例12: revealActivity
import android.animation.Animator; //导入方法依赖的package包/类
private void revealActivity(View revealView, int startCenterX, int startCenterY) {
int endCenterX = revealView.getWidth() / 2;
int endCenterY = revealView.getHeight() / 2;
float startRadius = 0;
float finalRadius = Math.max(revealView.getWidth(), revealView.getHeight()) * 1.1f;
Animator circularReveal = ViewAnimationCompatUtils.createCircularReveal(revealView, startCenterX, startCenterY, startRadius, endCenterX, endCenterY, finalRadius);
circularReveal.setDuration(500);
circularReveal.setInterpolator(new AccelerateInterpolator());
revealView.setVisibility(View.VISIBLE);
circularReveal.start();
}
示例13: start
import android.animation.Animator; //导入方法依赖的package包/类
@Override
public void start() {
Animator a = mAnimator.get();
if(a != null) {
a.start();
}
}
示例14: startSelectedViewInAnimation
import android.animation.Animator; //导入方法依赖的package包/类
private void startSelectedViewInAnimation() {
Animator animator = mSelectionInAnimator;
animator.setTarget(mSelectorHolder.itemView);
animator.addListener(new AbstractAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
updateCategoriesOffsetBySelector();
}
});
animator.start();
}
示例15: revealEffect
import android.animation.Animator; //导入方法依赖的package包/类
void revealEffect(View v) {
if(Build.VERSION.SDK_INT > 20) {
int cx = v.getMeasuredWidth()/2;
int cy = v.getMeasuredHeight()/2;
int finalRadius = Math.max(v.getWidth(),v.getHeight());
Animator a = ViewAnimationUtils.createCircularReveal(v,cx,cy,0,finalRadius);
a.setDuration(1000);
v.setVisibility(View.VISIBLE);
a.start();
}
}