本文整理汇总了Java中android.animation.AnimatorSet类的典型用法代码示例。如果您正苦于以下问题:Java AnimatorSet类的具体用法?Java AnimatorSet怎么用?Java AnimatorSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnimatorSet类属于android.animation包,在下文中一共展示了AnimatorSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openDrawer
import android.animation.AnimatorSet; //导入依赖的package包/类
public void openDrawer(boolean fast) {
if (!allowOpenDrawer) {
return;
}
if (AndroidUtilities.isTablet() && parentActionBarLayout != null && parentActionBarLayout.parentActivity != null) {
AndroidUtilities.hideKeyboard(parentActionBarLayout.parentActivity.getCurrentFocus());
}
cancelCurrentAnimation();
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(this, "drawerPosition", drawerLayout.getMeasuredWidth()));
animatorSet.setInterpolator(new DecelerateInterpolator());
if (fast) {
animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * (drawerLayout.getMeasuredWidth() - drawerPosition)), 50));
} else {
animatorSet.setDuration(300);
}
animatorSet.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animator) {
onDrawerAnimationEnd(true);
}
});
animatorSet.start();
currentAnimation = animatorSet;
}
示例2: CircularAnimatedDrawable
import android.animation.AnimatorSet; //导入依赖的package包/类
/**
* @param view View to be animated
* @param borderWidth The width of the spinning bar
* @param arcColor The color of the spinning bar
*/
public CircularAnimatedDrawable(View view, float borderWidth, int arcColor, @DrawableRes int innerResource, @ColorInt int innerResourceColorFilter) {
mAnimatedView = view;
mBorderWidth = borderWidth;
if (innerResource != 0) {
setInnerResource(innerResource);
setInnerResourceColorFilter(innerResourceColorFilter);
}
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(borderWidth);
mPaint.setColor(arcColor);
setupAnimations();
shouldDraw = true;
mAnimatorSet = new AnimatorSet();
}
示例3: onCreate
import android.animation.AnimatorSet; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
user = (ClearEditText) findViewById(R.id.user);
user.addTextChangedListener(userTextWatcher);
user.setOnFocusChangeListener(this);
pass = (ClearEditText) findViewById(R.id.pass);
pass.setOnFocusChangeListener(this);
pass.addTextChangedListener(passTextWatcher);
login = (Button) findViewById(R.id.login);
login.setOnClickListener(this);
register = (Button) findViewById(R.id.register);
register.setOnClickListener(this);
forget = (TextView) findViewById(R.id.forget);
ObjectAnimator animator = ObjectAnimator.ofFloat(forget, "rotation", 0, 360f);
ObjectAnimator animator1 = ObjectAnimator.ofFloat(forget, "alpha", 1f, 0f, 1f);
AnimatorSet set = new AnimatorSet();
set.play(animator).with(animator1);
set.setDuration(5000);
set.start();
}
示例4: prepareStateChange
import android.animation.AnimatorSet; //导入依赖的package包/类
@Override
public void prepareStateChange(State toState, AnimatorSet targetAnim) {
int finalAlpha = getAlphaForState(toState);
if (targetAnim == null) {
mBgPaint.setAlpha(finalAlpha);
invalidate();
} else {
ObjectAnimator anim = ObjectAnimator.ofArgb(mBgPaint, "alpha", finalAlpha);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
invalidate();
}
});
targetAnim.play(anim);
}
}
示例5: createDismissAnimator
import android.animation.AnimatorSet; //导入依赖的package包/类
public Animator createDismissAnimator(final View target) {
if (mHasCustomAnimationParams) {
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_X, mDismissEndXScale);
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_Y, mDismissEndYScale);
final AnimatorSet dismissAnimator = new AnimatorSet();
dismissAnimator.play(scaleXAnimator).with(scaleYAnimator);
final int dismissDuration = Math.min(mDismissDuration, mLingerTimeout);
dismissAnimator.setDuration(dismissDuration);
dismissAnimator.setInterpolator(ACCELERATE_INTERPOLATOR);
return dismissAnimator;
}
final Animator animator = AnimatorInflater.loadAnimator(
target.getContext(), mDismissAnimatorResId);
animator.setTarget(target);
animator.setInterpolator(ACCELERATE_INTERPOLATOR);
return animator;
}
示例6: prepare
import android.animation.AnimatorSet; //导入依赖的package包/类
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
ViewGroup parent = (ViewGroup) target.getParent();
int distance = parent.getHeight() - target.getTop();
animatorSet.playTogether(
ObjectAnimator.ofFloat(target, "alpha", 0, 1),
ObjectAnimator.ofFloat(target, "translationY", distance, 0)
);
}
示例7: hideRecordedAudioPanel
import android.animation.AnimatorSet; //导入依赖的package包/类
private void hideRecordedAudioPanel() {
audioToSendPath = null;
audioToSend = null;
audioToSendMessageObject = null;
AnimatorSet AnimatorSet = new AnimatorSet();
AnimatorSet.playTogether(
ObjectAnimator.ofFloat(recordedAudioPanel, "alpha", 0.0f)
);
AnimatorSet.setDuration(200);
AnimatorSet.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animation) {
recordedAudioPanel.setVisibility(GONE);
}
});
AnimatorSet.start();
}
示例8: getAnimationToState
import android.animation.AnimatorSet; //导入依赖的package包/类
public AnimatorSet getAnimationToState(Workspace.State fromState, Workspace.State toState,
boolean animated, HashMap<View, Integer> layerViews) {
AccessibilityManager am = (AccessibilityManager)
mLauncher.getSystemService(Context.ACCESSIBILITY_SERVICE);
final boolean accessibilityEnabled = am.isEnabled();
TransitionStates states = new TransitionStates(fromState, toState);
int workspaceDuration = getAnimationDuration(states);
animateWorkspace(states, animated, workspaceDuration, layerViews,
accessibilityEnabled);
animateBackgroundGradient(states, animated, BACKGROUND_FADE_OUT_DURATION);
return mStateAnimator;
}
示例9: animateSunblind
import android.animation.AnimatorSet; //导入依赖的package包/类
public static void animateSunblind(RecyclerView.ViewHolder holder, boolean goesDown) {
int holderHeight = holder.itemView.getHeight();
holder.itemView.setPivotY(goesDown == true ? 0 : holderHeight);
holder.itemView.setPivotX(holder.itemView.getHeight());
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(holder.itemView, "translationY", goesDown == true ? 300 : -300, 0);
ObjectAnimator animatorRotation = ObjectAnimator.ofFloat(holder.itemView, "rotationX", goesDown == true ? -90f : 90, 0f);
ObjectAnimator animatorScaleX = ObjectAnimator.ofFloat(holder.itemView, "scaleX", 0.5f, 1f);
animatorSet.playTogether(animatorTranslateY, animatorRotation, animatorScaleX);
animatorSet.setInterpolator(new DecelerateInterpolator(1.1f));
animatorSet.setDuration(1000);
animatorSet.start();
}
示例10: 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;
}
示例11: startAnimation
import android.animation.AnimatorSet; //导入依赖的package包/类
private void startAnimation() {
float sunYStart = mSunView.getTop();
float sunYEnd = mSkyView.getHeight();
ObjectAnimator heightAnimator = ObjectAnimator
.ofFloat(mSunView, "y", sunYStart, sunYEnd)
.setDuration(3000);
heightAnimator.setInterpolator(new AccelerateInterpolator());
ObjectAnimator sunsetSkyAnimator = ObjectAnimator
.ofInt(mSkyView, "backgroundColor", mBlueSkyColor, mSunsetSkyColor)
.setDuration(3000);
sunsetSkyAnimator.setEvaluator(new ArgbEvaluator());
ObjectAnimator nightSkyAnimator = ObjectAnimator
.ofInt(mSkyView, "backgroundColor", mSunsetSkyColor, mNightSkyColor)
.setDuration(1500);
nightSkyAnimator.setEvaluator(new ArgbEvaluator());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet
.play(heightAnimator)
.with(sunsetSkyAnimator)
.before(nightSkyAnimator);
animatorSet.start();
}
示例12: createOpenAnimation
import android.animation.AnimatorSet; //导入依赖的package包/类
@Override
public Animator createOpenAnimation(boolean isContainerAboveIcon, boolean pivotLeft) {
AnimatorSet openAnimation = LauncherAnimUtils.createAnimatorSet();
openAnimation.play(super.createOpenAnimation(isContainerAboveIcon, pivotLeft));
for (int i = 0; i < mShortcutsLayout.getChildCount(); i++) {
if (!(mShortcutsLayout.getChildAt(i) instanceof DeepShortcutView)) {
continue;
}
DeepShortcutView shortcutView = ((DeepShortcutView) mShortcutsLayout.getChildAt(i));
View deepShortcutIcon = shortcutView.getIconView();
deepShortcutIcon.setScaleX(0);
deepShortcutIcon.setScaleY(0);
openAnimation.play(LauncherAnimUtils.ofPropertyValuesHolder(
deepShortcutIcon, new PropertyListBuilder().scale(1).build()));
}
return openAnimation;
}
示例13: createCloseAnimation
import android.animation.AnimatorSet; //导入依赖的package包/类
@Override
public Animator createCloseAnimation(boolean isContainerAboveIcon, boolean pivotLeft,
long duration) {
AnimatorSet closeAnimation = LauncherAnimUtils.createAnimatorSet();
closeAnimation.play(super.createCloseAnimation(isContainerAboveIcon, pivotLeft, duration));
for (int i = 0; i < mShortcutsLayout.getChildCount(); i++) {
if (!(mShortcutsLayout.getChildAt(i) instanceof DeepShortcutView)) {
continue;
}
DeepShortcutView shortcutView = ((DeepShortcutView) mShortcutsLayout.getChildAt(i));
View deepShortcutIcon = shortcutView.getIconView();
deepShortcutIcon.setScaleX(1);
deepShortcutIcon.setScaleY(1);
closeAnimation.play(LauncherAnimUtils.ofPropertyValuesHolder(
deepShortcutIcon, new PropertyListBuilder().scale(0).build()));
}
return closeAnimation;
}
示例14: prepare
import android.animation.AnimatorSet; //导入依赖的package包/类
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
animatorSet.playTogether(
ObjectAnimator.ofFloat(target, "scaleX", 0.45f, 1),
ObjectAnimator.ofFloat(target, "scaleY", 0.45f, 1),
ObjectAnimator.ofFloat(target, "alpha", 0, 1)
);
}
示例15: 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();
}