本文整理汇总了Java中android.animation.AnimatorSet.setInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java AnimatorSet.setInterpolator方法的具体用法?Java AnimatorSet.setInterpolator怎么用?Java AnimatorSet.setInterpolator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.AnimatorSet
的用法示例。
在下文中一共展示了AnimatorSet.setInterpolator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hideMenu
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@SuppressWarnings("NewApi")
private void hideMenu() {
List<Animator> animList = new ArrayList<>();
for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(time);
animSet.setInterpolator(new AnticipateInterpolator());
animSet.playTogether(animList);
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
menuLayout.setVisibility(View.GONE);
}
});
animSet.start();
}
示例2: animateTo
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void animateTo(float newScale, float newTx, float newTy, boolean isZoom, int duration) {
if (scale == newScale && translationX == newTx && translationY == newTy) {
return;
}
zoomAnimation = isZoom;
animateToScale = newScale;
animateToX = newTx;
animateToY = newTy;
animationStartTime = System.currentTimeMillis();
imageMoveAnimation = new AnimatorSet();
imageMoveAnimation.playTogether(
ObjectAnimator.ofFloat(this, "animationValue", 0, 1)
);
imageMoveAnimation.setInterpolator(interpolator);
imageMoveAnimation.setDuration(duration);
imageMoveAnimation.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animation) {
imageMoveAnimation = null;
containerView.invalidate();
}
});
imageMoveAnimation.start();
}
示例3: hideMenu
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@SuppressWarnings("NewApi")
private void hideMenu() {
List<Animator> animList = new ArrayList<>();
for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
}
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(400);
animSet.setInterpolator(new AnticipateInterpolator());
animSet.playTogether(animList);
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
menuLayout.setVisibility(View.INVISIBLE);
}
});
animSet.start();
}
示例4: DisappearingAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
public DisappearingAnimator(boolean removeDialog) {
mIsDialogClosing = removeDialog;
Animator sheetFader = ObjectAnimator.ofFloat(
mRequestView, View.ALPHA, mRequestView.getAlpha(), 0f);
Animator sheetTranslator = ObjectAnimator.ofFloat(
mRequestView, View.TRANSLATION_Y, 0f, mAnimatorTranslation);
AnimatorSet current = new AnimatorSet();
current.setDuration(DIALOG_EXIT_ANIMATION_MS);
current.setInterpolator(new FastOutLinearInInterpolator());
if (mIsDialogClosing) {
Animator scrimFader = ObjectAnimator.ofInt(mFullContainer.getBackground(),
AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 127, 0);
current.playTogether(sheetFader, sheetTranslator, scrimFader);
} else {
current.playTogether(sheetFader, sheetTranslator);
}
mSheetAnimator = current;
mSheetAnimator.addListener(this);
mSheetAnimator.start();
}
示例5: createAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null || changeBounds == null) {
return null;
}
Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);
if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
return null;
}
MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius);
// hide child views (offset down & fade out)
if (endValues.view instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) endValues.view;
for (int i = 0; i < vg.getChildCount(); i++) {
View v = vg.getChildAt(i);
v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
.setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in))
.start();
}
}
AnimatorSet transition = new AnimatorSet();
transition.playTogether(changeBounds, corners, color);
transition.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
transition.setDuration(300);
return transition;
}
示例6: showAfter
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
protected void showAfter() {
View rootView = getRootView();
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator alpha = ObjectAnimator.ofFloat(rootView, "alpha", 0, 1);
ObjectAnimator translation = ObjectAnimator.ofFloat(rootView, "translationY", 300, 0);
animatorSet.playTogether(alpha, translation);
animatorSet.setDuration(2000);
animatorSet.setInterpolator(new AccelerateInterpolator());
animatorSet.start();
}
示例7: 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();
}
示例8: 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();
}
示例9: showFooter
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Function to show footer
*/
public void showFooter() {
DisplayMetrics metrics = getResources().getDisplayMetrics();
screenHeight = metrics.heightPixels;
ObjectAnimator animY = ObjectAnimator.ofFloat(footerContainer, "y", screenHeight
- footerContainer.getHeight());
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.setInterpolator(new LinearInterpolator());
animSetXY.playSequentially(animY);
animSetXY.start();
}
示例10: getEnterAnimtor
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private AnimatorSet getEnterAnimtor(final View target) {
ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f);
AnimatorSet enter = new AnimatorSet();
enter.setDuration(300);
enter.setInterpolator(new LinearInterpolator());
enter.playTogether(alpha, scaleX, scaleY);
enter.setTarget(target);
return enter;
}
示例11: getAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private Animator getAnimator(LeafHolder target, RectF leafFlyRect, float progress) {
ValueAnimator bezierValueAnimator = getBezierValueAnimator(target, leafFlyRect, progress);
AnimatorSet finalSet = new AnimatorSet();
finalSet.playSequentially(bezierValueAnimator);
finalSet.setInterpolator(INTERPOLATORS[mRandom.nextInt(INTERPOLATORS.length)]);
finalSet.setTarget(target);
return finalSet;
}
示例12: flipHorizontally
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Animates a horizontal (about the y-axis) flip of this card.
* @param numberInPile Specifies how many cards are underneath this card in the new
* pile so as to properly adjust its position offset in the stack.
* @param clockwise Specifies whether the horizontal animation is 180 degrees
* clockwise or 180 degrees counter clockwise.
*/
public void flipHorizontally (int numberInPile, boolean clockwise, int velocity) {
toggleFrontShowing();
PropertyValuesHolder rotation = PropertyValuesHolder.ofFloat(View.ROTATION_Y,
clockwise ? 180 : -180);
PropertyValuesHolder xOffset = PropertyValuesHolder.ofFloat(View.TRANSLATION_X,
numberInPile * CardFlip.CARD_PILE_OFFSET);
PropertyValuesHolder yOffset = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y,
numberInPile * CardFlip.CARD_PILE_OFFSET);
ObjectAnimator cardAnimator = ObjectAnimator.ofPropertyValuesHolder(this, rotation,
xOffset, yOffset);
cardAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (valueAnimator.getAnimatedFraction() >= 0.5) {
updateDrawableBitmap();
}
}
});
Keyframe shadowKeyFrameStart = Keyframe.ofFloat(0, 0);
Keyframe shadowKeyFrameMid = Keyframe.ofFloat(0.5f, 1);
Keyframe shadowKeyFrameEnd = Keyframe.ofFloat(1, 0);
PropertyValuesHolder shadowPropertyValuesHolder = PropertyValuesHolder.ofKeyframe
("shadow", shadowKeyFrameStart, shadowKeyFrameMid, shadowKeyFrameEnd);
ObjectAnimator colorizer = ObjectAnimator.ofPropertyValuesHolder(this,
shadowPropertyValuesHolder);
mCardFlipListener.onCardFlipStart();
AnimatorSet set = new AnimatorSet();
int duration = MAX_FLIP_DURATION - Math.abs(velocity) / VELOCITY_TO_DURATION_CONSTANT;
duration = duration < MIN_FLIP_DURATION ? MIN_FLIP_DURATION : duration;
set.setDuration(duration);
set.playTogether(cardAnimator, colorizer);
set.setInterpolator(new AccelerateDecelerateInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
toggleIsHorizontallyFlipped();
updateDrawableBitmap();
updateLayoutParams();
mCardFlipListener.onCardFlipEnd();
}
});
set.start();
}
示例13: createCustomAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void createCustomAnimation() {
AnimatorSet set = new AnimatorSet();
ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleX", 1.0f, 0.2f);
ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleY", 1.0f, 0.2f);
ObjectAnimator scaleInX = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleX", 0.2f, 1.0f);
ObjectAnimator scaleInY = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleY", 0.2f, 1.0f);
scaleOutX.setDuration(50);
scaleOutY.setDuration(50);
scaleInX.setDuration(150);
scaleInY.setDuration(150);
scaleInX.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
fabNote.getMenuIconView().setImageResource(fabNote.isOpened() ? R.mipmap.fab_add : R.mipmap.ic_edit);
}
});
set.play(scaleOutX).with(scaleOutY);
set.play(scaleInX).with(scaleInY).after(scaleOutX);
set.setInterpolator(new OvershootInterpolator(2));
fabNote.setIconToggleAnimatorSet(set);
}
示例14: onStartAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
protected void onStartAnimation() {
AnimatorSet animatorSet = new AnimatorSet();
if (mode.equals(TranslationMode.TranslationAll)) {
ObjectAnimator animatorTranslationY = ObjectAnimator.ofFloat(view, "translationY",
startPoint, endPoint);
ObjectAnimator animatorTranslationX = ObjectAnimator.ofFloat(view, "translationX",
additionStartPoint, additionEndPoint);
if (arcMode.equals(ArcMode.ArcUpward)) {
animatorTranslationY.setDuration(SMALL_ANIMATION_DURATION);
animatorTranslationX.setDuration(LARGE_ANIMATION_DURATION);
} else {
animatorTranslationY.setDuration(SMALL_ANIMATION_DOWNARD);
animatorTranslationX.setDuration(LARGE_ANIMATION_DURATION);
}
animatorSet.setInterpolator(new LinearOutSlowInInterpolator());
animatorSet.play(animatorTranslationY).with(animatorTranslationX);
animatorSet.start();
} else {
final ValueAnimator valueAnimator = ValueAnimator.ofFloat(startPoint, endPoint);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (float) valueAnimator.getAnimatedValue();
switch (mode) {
case TranslationY:
view.setTranslationY(value);
break;
case TranslationX:
view.setTranslationX(value);
break;
}
}
});
valueAnimator.setInterpolator(new FastOutSlowInInterpolator());
valueAnimator.setDuration(LARGE_ANIMATION_DURATION);
valueAnimator.start();
}
}
示例15: songsBtns
import android.animation.AnimatorSet; //导入方法依赖的package包/类
public songsBtns(Context context, int width, int height) {
super(context, width, height);
setBackgroundColor(0x99000000);
Menu = new FMlyt(context, Ui.cd.DPW - Ui.cd.getHt(40), Ui.cd.getHt(500)){
@Override
protected void onDraw(Canvas canvas){
back.draw(canvas);
canvas.clipPath(back.S0);
super.onDraw(canvas);
}
};
back = new radiusSqure(Menu.width,Menu.height,0,0, Ui.cd.getHt(13));
back.setColor(backgroundImg.Color0);
Menu.InCenter(width,height);
Menu.setBackgroundColor(0x00000000);
addView(Menu);
setAlpha(0);
MainIcon = songsIcon.getFMview(context,true);
MainIcon.setSize(Ui.cd.getHt(40), Ui.cd.getHt(40));
MainIcon.setX(Ui.cd.getHt(5));
MainIcon.setY(Ui.cd.getHt(5));
Menu.addView(MainIcon);
final ShapeView cb = menucloseBtn.getFMview(getContext(),true);
cb.setRipple(true,0.3f);
cb.onClick(new call(){
@Override
public void onCall(boolean bl) {
Ui.bk.back();
}
});
cb.setX(Menu.width - cb.width);
Menu.addView(cb);
FMText title = textImg.getFMText(getContext(),"SONG OPTIONS", Ui.cd.getHt(16));
title.InCenter(MainIcon);
title.img.setColor(0x99ffffff);
title.setX(MainIcon.width + Ui.cd.getHt(20));
Menu.addView(title);
FMText forText = textImg.getFMText(getContext(),"ADD TO PLAYLIST BY CLICK", Ui.cd.getHt(12));
forText.img.setColor(0x66ffffff);
forText.setX(MainIcon.width + Ui.cd.getHt(20));
forText.setY(title.getY() + title.height + Ui.cd.getHt(10));
Menu.addView(forText);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Ui.bk.back();
}
});
Set = new AnimatorSet();
Set.setInterpolator(Ui.cd.TH);
Set.setDuration(200);
Set.playTogether(
ObjectAnimator.ofFloat(this, "Alpha", 1.0F)
);
Set.start();
setList();
}