本文整理汇总了Java中android.animation.AnimatorSet.play方法的典型用法代码示例。如果您正苦于以下问题:Java AnimatorSet.play方法的具体用法?Java AnimatorSet.play怎么用?Java AnimatorSet.play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.AnimatorSet
的用法示例。
在下文中一共展示了AnimatorSet.play方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
super.endAnimation(dynamicWeatherView, listener);
ValueAnimator animator1 = ValueAnimator.ofFloat(1, 0);
animator1.setInterpolator(new AccelerateInterpolator());
animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
speed = (float) animation.getAnimatedValue() * 32;
rotate = (float) animation.getAnimatedValue();
}
});
AnimatorSet animSet = new AnimatorSet();
animSet.play(animator1);
animSet.setDuration(1000);
if (listener != null) {
animSet.addListener(listener);
}
animSet.start();
}
示例2: startAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public void startAnimation(final DynamicWeatherView dynamicWeatherView, int fromColor) {
super.startAnimation(dynamicWeatherView, fromColor);
ValueAnimator animator1 = ValueAnimator.ofFloat(0, 1);
animator1.setInterpolator(new OvershootInterpolator());
animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
speed = (float) animation.getAnimatedValue() * 32;
rotate = (float) animation.getAnimatedValue();
}
});
AnimatorSet animSet = new AnimatorSet();
animSet.play(animator1);
animSet.setDuration(1000);
animSet.start();
}
示例3: getAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Nullable
@Override
protected Animator getAnimator(@NonNull ViewGroup container, @NonNull SceneInfo upper,
@NonNull List<SceneInfo> lower) {
AnimatorSet set = new AnimatorSet();
Animator animator = getAnimator(container, upper, true);
if (animator != null) {
set.play(animator);
}
for (SceneInfo info : lower) {
animator = getAnimator(container, info, false);
if (animator != null) {
set.play(animator);
}
}
return set;
}
示例4: giftEnterAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public AnimatorSet giftEnterAnimation(final GiftAnimationLayout layout, AbsGiftViewHolder holder) {
//礼物飞入
ObjectAnimator animator = GiftAnimationUtils.createTranslationXAnimator(layout, 1500, 0, 2000, new DecelerateInterpolator());
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
layout.startNumberComboAnimation();
}
});
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(animator);
animatorSet.start();
return animatorSet;
}
示例5: getAddAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
protected Animator getAddAnimator(View view, int top, int position, int addOccurTop, int addOccurPosition) {
view.setAlpha(0);
view.clearAnimation();
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(alphaObjectAnimator(view, true, 50, false));
if (addOccurTop != top) {
animatorSet.play(getOffsetAnimator(view, addOccurTop, top));
}
animatorSet.setStartDelay((long) (view.getHeight() * mOffsetDurationUnit));
return animatorSet;
}
示例6: doPreLayoutAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void doPreLayoutAnimation(Animator.AnimatorListener listener) {
final AnimatorSet animatorSet = new AnimatorSet();
ArrayList<Long> deleteIds = new ArrayList<>();
int i;
for (i = 0; i < mTopMap.size(); i++) {
long id = mTopMap.keyAt(i);
int newPos = getPositionForId(id);
if (newPos < 0) {
// delete
int oldPos = mPositionMap.get(id);
View child = getChildAt(oldPos);
final Animator anim = getDeleteAnimator(child);
mPositionMap.remove(id);
animatorSet.play(anim);
deleteIds.add(id);
}
}
for (i = 0; i < deleteIds.size(); i++) {
mTopMap.remove(deleteIds.get(i));
}
if (mOpenChangeDisappearAnimation) {
for (i = 0; i < mPositionMap.size(); i++) {
View view = getChildAt(mPositionMap.valueAt(i));
ViewCompat.setHasTransientState(view, true);
mDetachViewsMap.put(mPositionMap.keyAt(i), view);
}
}
if (!animatorSet.getChildAnimations().isEmpty()) {
animatorSet.addListener(listener);
animatorSet.start();
} else {
listener.onAnimationEnd(animatorSet);
}
}
示例7: createAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
protected Animator createAnimator(@NonNull View from, @NonNull View to, int direction) {
int fromTranslation = (-1) * direction * from.getWidth();
int toTranslation = direction * to.getWidth();
AnimatorSet set = new AnimatorSet();
set.play(ObjectAnimator.ofFloat(from, "translationX", fromTranslation));
set.play(ObjectAnimator.ofFloat(to, "translationX", toTranslation, 0));
return set;
}
示例8: hideToolbar
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Function to hide tool bar "animation"
*/
public void hideToolbar() {
ObjectAnimator animY = ObjectAnimator.ofFloat(header, "y", -(header.getHeight()));
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.setInterpolator(new LinearInterpolator());
animSetXY.play(animY);
animSetXY.start();
}
示例9: hideToolbar
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Function to hide tool bar
*/
public void hideToolbar() {
ObjectAnimator toolbarAnimY = ObjectAnimator.ofFloat(myToolbarContainer, "y", -(myToolbarContainer.getHeight()));
AnimatorSet toolbarHideAnimation = new AnimatorSet();
toolbarHideAnimation.setInterpolator(new LinearInterpolator());
toolbarHideAnimation.play(toolbarAnimY);
toolbarHideAnimation.start();
}
示例10: createAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
protected Animator createAnimator(@NonNull View previousView, @NonNull View newView, int direction) {
AnimatorSet set = new AnimatorSet();
set.play(ObjectAnimator.ofFloat(previousView, "alpha", 1, 0));
set.play(ObjectAnimator.ofFloat(newView, "alpha", 0, 1));
return set;
}
示例11: showToolbar
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Function to show tool bar "animation"
*/
public void showToolbar() {
ObjectAnimator animY = ObjectAnimator.ofFloat(header, "y", 0);
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.setInterpolator(new LinearInterpolator());
animSetXY.play(animY);
animSetXY.start();
}
示例12: runMenuItemEnterAnimations
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void runMenuItemEnterAnimations() {
mMenuItemEnterAnimator = new AnimatorSet();
AnimatorSet.Builder builder = null;
ViewGroup list = mPopup.getListView();
for (int i = 0; i < list.getChildCount(); i++) {
View view = list.getChildAt(i);
Object animatorObject = view.getTag(R.id.menu_item_enter_anim_id);
if (animatorObject != null) {
if (builder == null) {
builder = mMenuItemEnterAnimator.play((Animator) animatorObject);
} else {
builder.with((Animator) animatorObject);
}
}
}
mMenuItemEnterAnimator.addListener(mAnimationHistogramRecorder);
mMenuItemEnterAnimator.start();
}
示例13: runRevealNProgress
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void runRevealNProgress(){
revealAnimator.setDuration(duration(R.integer.conceal_duration));
revealAnimator.setInterpolator(new DecelerateInterpolator());
seekBar.setProgress(80);
ObjectAnimator progressAnimator=ObjectAnimator.ofInt(seekBar,"progress",80,20);
ObjectAnimator scaleY=ObjectAnimator.ofFloat(seekBar,View.SCALE_Y,0,1f);
progressAnimator.setInterpolator(new DecelerateInterpolator());
progressAnimator.setDuration(duration(R.integer.progress_duration));
scaleY.setDuration(duration(R.integer.progress_duration));
AnimatorSet animatorSet=new AnimatorSet();
animatorSet.play(revealAnimator);
animatorSet.play(progressAnimator).with(scaleY);
animatorSet.start();
}
示例14: revealSides
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@OnClick({R.id.first,R.id.third})
public void revealSides(FloatingActionButton dot) {
if (finished) {
finished=false;
lastDot = dot;
float deltaX = topPanel.getWidth() / 2 - dot.getX() - dot.getWidth() / 2;
float deltaY = topPanel.getHeight() / 2 - dot.getY() - dot.getHeight() / 2;
deltaY -= topPanel.getHeight() / 2 + getResources().getDimension(R.dimen.morph_radius) / 4;
Path arcPath = createArcPath(dot, deltaX, deltaY, -deltaX);
ValueAnimator pathAnimator = ValueAnimator.ofFloat(0, 1);
pathAnimator.addUpdateListener(new ArcListener(arcPath, dot));
int dotColor=dot.getBackgroundTintList().getDefaultColor();
topPanel.setBackgroundColor(dotColor);
if(dotColor==color) {
backgroundReveal().start();
}
pathAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
Animator animator = createRevealAnimator(dot, 0);
finish(animator);
animator.start();
runCloseAnimation();
}
});
AnimatorSet animatorSet = morphParent(duration(R.integer.reveal_duration));
animatorSet.play(pathAnimator);
addScaleAnimation(duration(R.integer.short_delay), duration(R.integer.fade_duration), animatorSet);
animatorSet.start();
}
}
示例15: createAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
Animator createAnimator() {
// The amount by which mNewFrontWrapper will grow (negative value indicates shrinking).
int deltaHeight = (mNewFrontWrapper.getHeight() - mBackInfobarHeight)
- mOldFrontWrapper.getHeight();
int startTranslationY = Math.max(deltaHeight, 0);
int endTranslationY = Math.max(-deltaHeight, 0);
// Slide the front infobar down and away.
AnimatorSet animator = new AnimatorSet();
mOldFrontWrapper.setTranslationY(startTranslationY);
animator.play(createTranslationYAnimator(mOldFrontWrapper,
startTranslationY + mOldFrontWrapper.getHeight())
.setDuration(DURATION_SLIDE_UP_MS));
// Slide the other infobars to their new positions.
// Note: animator.play() causes these animations to run simultaneously.
for (int i = 1; i < mInfoBarWrappers.size(); i++) {
mInfoBarWrappers.get(i).setTranslationY(startTranslationY);
animator.play(createTranslationYAnimator(mInfoBarWrappers.get(i),
endTranslationY).setDuration(DURATION_SLIDE_UP_MS));
}
mNewFrontContents.setAlpha(0f);
animator.play(ObjectAnimator.ofFloat(mNewFrontContents, View.ALPHA, 1f)
.setDuration(DURATION_FADE_MS)).after(DURATION_SLIDE_UP_MS);
return animator;
}