本文整理匯總了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;
}