本文整理匯總了Java中android.animation.AnimatorSet.start方法的典型用法代碼示例。如果您正苦於以下問題:Java AnimatorSet.start方法的具體用法?Java AnimatorSet.start怎麽用?Java AnimatorSet.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.animation.AnimatorSet
的用法示例。
在下文中一共展示了AnimatorSet.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: animateDisplayWave
import android.animation.AnimatorSet; //導入方法依賴的package包/類
/**
* 動畫
*/
private void animateDisplayWave() {
if (left_WaveView != null && center_WaveView != null) {
left_WaveView.setAnimationCacheEnabled(false);
center_WaveView.setAnimationCacheEnabled(false);
ObjectAnimator transX_waveLeft = ObjectAnimator.ofFloat(left_WaveView, "translationX", 0, 1920);
ObjectAnimator transX_waveCenter = ObjectAnimator.ofFloat(center_WaveView, "translationX", 0, 1920);
transX_waveLeft.setRepeatMode(ValueAnimator.RESTART);
transX_waveLeft.setRepeatCount(Animation.INFINITE);
transX_waveCenter.setRepeatMode(ValueAnimator.RESTART);
transX_waveCenter.setRepeatCount(Animation.INFINITE);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(16000);
animatorSet.setInterpolator(new LinearInterpolator());
animatorSet.playTogether(transX_waveLeft, transX_waveCenter);
animatorSet.start();
}
}
示例2: roundLoad
import android.animation.AnimatorSet; //導入方法依賴的package包/類
public void roundLoad(View myView) {
int cx = (myView.getLeft() + myView.getRight()) / 2;
int cy = (myView.getTop() + myView.getBottom()) / 2;
// get the final radius for the clipping circle
int finalRadius = Math.max(myView.getWidth(), myView.getHeight());
AnimatorSet animatorSet = new AnimatorSet();
// create the animator for this view (the start radius is zero)
Animator anim =
ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
anim.setDuration(1000);
anim.setInterpolator(new AccelerateInterpolator());
Animator anim1 = ObjectAnimator.ofFloat(myView, "translationZ", 0f, 50f);
anim1.setDuration(1500);
anim1.setInterpolator(new AccelerateInterpolator());
animatorSet.play(anim).with(anim1);
// make the view visible and start the animation
myView.setVisibility(View.VISIBLE);
animatorSet.start();
}
示例3: onBind
import android.animation.AnimatorSet; //導入方法依賴的package包/類
@Override
public void onBind(Target view, Value o, final OnBindListener onBindListener) {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, View.ROTATION, 0f, 10f);
ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, View.ROTATION_X, 0f, 90f);
AnimatorSet set = new AnimatorSet();
set.setInterpolator(new AccelerateInterpolator(2f));
set.setDuration(300);
set.setStartDelay(80 * count);
set.playTogether(animatorX, animatorY);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
onBindListener.onBindDone();
}
});
set.start();
count++;
}
示例4: 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();
}
示例5: startShowAnimation
import android.animation.AnimatorSet; //導入方法依賴的package包/類
void startShowAnimation() {
float toolBarYStart = mDetailToolBar.getTop();
float toolBarYEnd = mDetailToolBar.getTop() - mDetailToolBar.getBottom();
float floatingButtonYStart = mFloatingActionButton.getTop();
float floatingButtonYEnd = mViewPager.getBottom();
ObjectAnimator toolBarAnimator = ObjectAnimator
.ofFloat(mDetailToolBar, "y", toolBarYEnd, toolBarYStart)
.setDuration(500);
toolBarAnimator.setInterpolator(new AccelerateInterpolator());
ObjectAnimator floatingButtonAnimator = ObjectAnimator
.ofFloat(mFloatingActionButton, "y", floatingButtonYEnd, floatingButtonYStart)
.setDuration(500);
floatingButtonAnimator.setInterpolator(new AccelerateInterpolator());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet
.play(toolBarAnimator)
.before(floatingButtonAnimator);
animatorSet.start();
}
示例6: sunsetAnimator
import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void sunsetAnimator() {
float sunYStart = mSunView.getTop();
float sunYEnd = mSkyView.getHeight();
ObjectAnimator heightAnimator = ObjectAnimator.ofFloat(mSunView, "y", sunYStart, sunYEnd)
.setDuration(3000);
ObjectAnimator sunsetSkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
mBlueSkyColor, mSunsetSkyColor)
.setDuration(3000);
ObjectAnimator nightSkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
mSunsetSkyColor, mNightSkyColor)
.setDuration(1500);
heightAnimator.setInterpolator(new AccelerateInterpolator());
sunsetSkyAnimator.setEvaluator(new ArgbEvaluator());
nightSkyAnimator.setEvaluator(new ArgbEvaluator());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(heightAnimator).with(sunsetSkyAnimator).before(nightSkyAnimator);
animatorSet.start();
}
示例7: smoothScrollTo
import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void smoothScrollTo(int desX, int desY, AnimatorListener listener)
{
ObjectAnimator xTranslate = ObjectAnimator.ofInt(this, "scrollX", desX);
ObjectAnimator yTranslate = ObjectAnimator.ofInt(this, "scrollY", desY);
yTranslate.addUpdateListener(new AnimatorUpdateListener()
{
@Override
public void onAnimationUpdate(ValueAnimator animation)
{
if (mHeaderStatusChangedListener != null) mHeaderStatusChangedListener.onHeaderOffsetChanged((int) (mScrollOffsetHeight * animation.getAnimatedFraction()), animation.getAnimatedFraction());
}
});
AnimatorSet animators = new AnimatorSet();
animators.setDuration(240L);
animators.playTogether(xTranslate, yTranslate);
if (listener != null) animators.addListener(listener);
animators.start();
}
示例8: animateChange
import android.animation.AnimatorSet; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*
* Item's whose {@link RecyclerView.ViewHolder}s implement the {@link IAnimatedViewHolder} interface will have
* their {@link IAnimatedViewHolder#runChangeAnimation(GenericItemAnimator)} procedure called.
*
* @param oldHolder the old {@link RecyclerView} item's {@link RecyclerView.ViewHolder}. Might be the same
* instance with newHolder.
* @param newHolder the new {@link RecyclerView} item's {@link RecyclerView.ViewHolder}. Might be the same
* instance with oldHolder.
* @param preInfo The information that was returned from
* {@link #recordPreLayoutInformation(RecyclerView.State, RecyclerView.ViewHolder, int, List)}.
* @param postInfo The information that was returned from {@link
* #recordPreLayoutInformation(RecyclerView.State, RecyclerView.ViewHolder, int, List)}.
* @return a boolean value indicating whether the {@link RecyclerView} should use a change animation
* for the {@link RecyclerView.ViewHolder}.
*/
@Override
public boolean animateChange(@NonNull final RecyclerView.ViewHolder oldHolder,
@NonNull final RecyclerView.ViewHolder newHolder,
@NonNull final ItemHolderInfo preInfo, @NonNull final ItemHolderInfo postInfo) {
cancelCurrentAnimationIfExists(newHolder);
if (preInfo instanceof GenericAnimatedViewHolderInfo && newHolder instanceof IAnimatedViewHolder) {
final GenericAnimatedViewHolderInfo holderInfo = (GenericAnimatedViewHolderInfo) preInfo;
final IAnimatedViewHolder holder = (IAnimatedViewHolder) newHolder;
/* Call custom animation handlers */
final AnimatorSet animatorSet = handleCustomAnimation(holderInfo, holder);
if (animatorSet != null) {
mCustomAnimationsMap.put(newHolder, animatorSet);
animatorSet.start();
}
}
return false;
}
示例9: start
import android.animation.AnimatorSet; //導入方法依賴的package包/類
public void start(View view) {
if (lastAnimator != null) {
lastAnimator.removeAllListeners();
lastAnimator.end();
lastAnimator.cancel();
}
ObjectAnimator animX = ObjectAnimator.ofFloat(view, "scaleX", 1.6f, 1.0f);
ObjectAnimator animY = ObjectAnimator.ofFloat(view, "scaleY", 1.6f, 1.0f);
AnimatorSet animSet = new AnimatorSet();
lastAnimator = animSet;
animSet.setDuration(400);
animSet.setInterpolator(new OvershootInterpolator());
animSet.playTogether(animX, animY);
animSet.start();
}
示例10: hidePreview
import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void hidePreview() {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(stickerPreviewLayout, "alpha", 0.0f));
animatorSet.setDuration(200);
animatorSet.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animation) {
stickerPreviewLayout.setVisibility(View.GONE);
}
});
animatorSet.start();
}
示例11: checkEnhance
import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void checkEnhance() {
if (enhanceValue == 0) {
AnimatorSet AnimatorSet = new AnimatorSet();
AnimatorSet.setDuration(200);
AnimatorSet.playTogether(ObjectAnimator.ofInt(valueSeekBar, "progress", 50));
AnimatorSet.start();
}
}
示例12: toggleCheckImageView
import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void toggleCheckImageView(boolean show) {
AnimatorSet animatorSet = new AnimatorSet();
ArrayList<Animator> arrayList = new ArrayList<>();
arrayList.add(ObjectAnimator.ofFloat(pickerView, "alpha", show ? 1.0f : 0.0f));
if (sendPhotoType == 0) {
arrayList.add(ObjectAnimator.ofFloat(checkImageView, "alpha", show ? 1.0f : 0.0f));
}
animatorSet.playTogether(arrayList);
animatorSet.setDuration(200);
animatorSet.start();
}
示例13: startAnimations
import android.animation.AnimatorSet; //導入方法依賴的package包/類
/**
* Plays together all animations passed in as parameter. Once animation is
* completed, r.run() is executed. If parameter isReset is set to true,
* {@link #mSelectedCardPosition} is set to {@link #INVALID_CARD_POSITION}
*
* @param animations
* @param r
* @param isReset
*/
private void startAnimations(List<Animator> animations, final Runnable r, final boolean isReset) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(animations);
animatorSet.setDuration(ANIM_DURATION);
animatorSet.setInterpolator(new DecelerateInterpolator(DECELERATION_FACTOR));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (r != null)
r.run();
setScreenTouchable(true);
if (isReset)
mSelectedCardPosition = INVALID_CARD_POSITION;
}
});
animatorSet.start();
}
示例14: onTouch
import android.animation.AnimatorSet; //導入方法依賴的package包/類
@Override
public boolean onTouch(View view, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
AnimatorSet upSet = new AnimatorSet();
upSet.playTogether(
ObjectAnimator.ofFloat(view, "translationZ", 16),
ObjectAnimator.ofFloat(view, "scaleX", 1.05f),
ObjectAnimator.ofFloat(view, "scaleY", 1.05f)
);
upSet.setDuration(150);
upSet.setInterpolator(new DecelerateInterpolator());
upSet.start();
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
AnimatorSet downSet = new AnimatorSet();
downSet.playTogether(
ObjectAnimator.ofFloat(view, "translationZ", 0),
ObjectAnimator.ofFloat(view, "scaleX", 1f),
ObjectAnimator.ofFloat(view, "scaleY", 1f)
);
downSet.setDuration(150);
downSet.setInterpolator(new DecelerateInterpolator());
downSet.start();
break;
}
return false;
}
示例15: animateHeartButton
import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void animateHeartButton(final RecipesAdapter.RecipeViewHolder holder) {
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator rotation = ObjectAnimator.ofFloat(holder.likeButton, "rotation", 0.0f, 360.0f);
rotation.setDuration(800);
rotation.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(holder.likeButton, "scaleX", 1.0f, 1.5f, 1.0f);
scaleX.setDuration(800);
scaleX.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(holder.likeButton, "scaleY", 1.0f, 1.5f, 1.0f);
scaleY.setDuration(800);
scaleY.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);
rotation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (valueAnimator.getCurrentPlayTime() >= 500) {
holder.likeButton.setImageResource(R.drawable.ic_favorite_higlighted_24dp);
}
}
});
animatorSet.playTogether(rotation, scaleX, scaleY);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
dispatchAnimationFinished(holder);
}
});
animatorSet.start();
}