Java Code Examples for com.nineoldandroids.animation.AnimatorSet#setDuration()
The following examples show how to use
com.nineoldandroids.animation.AnimatorSet#setDuration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResideMenu.java From AndroidResideMenu with MIT License | 6 votes |
/** * A helper method to build scale up animation; * * @param target * @param targetScaleX * @param targetScaleY * @return */ private AnimatorSet buildScaleUpAnimation(View target, float targetScaleX, float targetScaleY) { AnimatorSet scaleUp = new AnimatorSet(); scaleUp.playTogether( ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY) ); if (mUse3D) { scaleUp.playTogether(ObjectAnimator.ofFloat(target, "rotationY", 0)); } scaleUp.setDuration(250); return scaleUp; }
Example 2
Source File: SwipeTouchListener.java From ListViewAnimations with Apache License 2.0 | 6 votes |
/** * Flings given {@link android.view.View} out of sight. * * @param view the parent {@link android.view.View}. * @param position the position of the item in the {@link android.widget.ListAdapter} corresponding to the {@code View}. * @param flingToRight {@code true} if the {@code View} should be flinged to the right, {@code false} if it should be flinged to the left. */ private void flingView(@NonNull final View view, final int position, final boolean flingToRight) { if (mViewWidth < 2) { mViewWidth = mListViewWrapper.getListView().getWidth(); } View swipeView = getSwipeView(view); ObjectAnimator xAnimator = ObjectAnimator.ofFloat(swipeView, TRANSLATION_X, flingToRight ? mViewWidth : -mViewWidth); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(swipeView, ALPHA, 0); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(xAnimator, alphaAnimator); animatorSet.setDuration(mAnimationTime); animatorSet.addListener(new FlingAnimatorListener(view, position)); animatorSet.start(); }
Example 3
Source File: BlurLayout.java From UltimateAndroid with Apache License 2.0 | 6 votes |
private void startBlurImageAppearAnimator(){ if(!enableBlurBackground || mBlurImage == null) return; AnimatorSet set = new AnimatorSet(); if(enableBackgroundZoom){ set.playTogether( ObjectAnimator.ofFloat(mBlurImage, "alpha", 0.8f, 1f), ObjectAnimator.ofFloat(mBlurImage, "scaleX", 1f, mZoomRatio), ObjectAnimator.ofFloat(mBlurImage, "scaleY", 1f, mZoomRatio) ); } else{ set.playTogether( ObjectAnimator.ofFloat(mBlurImage, "alpha", 0f, 1f) ); } set.addListener(mGlobalListener); set.addListener(mGlobalAppearingAnimators); set.setDuration(mBlurDuration); set.start(); }
Example 4
Source File: ResideMenu.java From AndroidResideMenu with MIT License | 6 votes |
/** * A helper method to build scale down animation; * * @param target * @param targetScaleX * @param targetScaleY * @return */ private AnimatorSet buildScaleDownAnimation(View target, float targetScaleX, float targetScaleY) { AnimatorSet scaleDown = new AnimatorSet(); scaleDown.playTogether( ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY) ); if (mUse3D) { int angle = scaleDirection == DIRECTION_LEFT ? -ROTATE_Y_ANGLE : ROTATE_Y_ANGLE; scaleDown.playTogether(ObjectAnimator.ofFloat(target, "rotationY", angle)); } scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity, android.R.anim.decelerate_interpolator)); scaleDown.setDuration(250); return scaleDown; }
Example 5
Source File: AnimationAdapter.java From HPlayer with Apache License 2.0 | 6 votes |
private void animateView(final ViewGroup parent, final View view) { if (mAnimationStartMillis == -1) { mAnimationStartMillis = System.currentTimeMillis(); } ViewHelper.setAlpha(view, 0); Animator[] childAnimators; if (mDecoratedBaseAdapter instanceof AnimationAdapter) { childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view); } else { childAnimators = new Animator[0]; } Animator[] animators = getAnimators(parent, view); Animator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1); AnimatorSet set = new AnimatorSet(); set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator)); set.setStartDelay(calculateAnimationDelay()); set.setDuration(getAnimationDurationMillis()); set.start(); mAnimators.put(view.hashCode(), set); }
Example 6
Source File: DynamicFormActivity.java From Android-Anim-Playground with MIT License | 6 votes |
private void slideInToTop(View editContainer, View movableView) { View v = findViewById(R.id.edit_mode_container); //put edit at the bottom Log.d(TAG, "container view height :" + String.valueOf(v.getHeight())); ObjectAnimator anim = ObjectAnimator.ofFloat(v, "translationY", mMainContainer.getHeight()); anim.setDuration(0); anim.start(); v.setVisibility(View.VISIBLE); AnimatorSet set = new AnimatorSet(); set.playTogether( ObjectAnimator.ofFloat(v, "translationY", editContainer.getTop()+movableView.getHeight()+modeContainerMargin), ObjectAnimator.ofFloat(v, "alpha", 0, 1) ); set.setDuration(ANIMATION_DURATION); set.setInterpolator(ANIMATION_INTERPOLATOR); set.start(); }
Example 7
Source File: ResideMenu.java From Libraries-for-Android-Developers with MIT License | 6 votes |
/** * a helper method to build scale down animation; * * @param target * @param targetScaleX * @param targetScaleY * @return */ private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float targetScaleY){ // set the pivotX and pivotY to scale; int pivotX = (int) (getScreenWidth() * 1.5); int pivotY = (int) (getScreenHeight() * 0.5); ViewHelper.setPivotX(target, pivotX); ViewHelper.setPivotY(target, pivotY); AnimatorSet scaleDown = new AnimatorSet(); scaleDown.playTogether( ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY) ); scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity, android.R.anim.decelerate_interpolator)); scaleDown.setDuration(250); return scaleDown; }
Example 8
Source File: ResideMenu.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 5 votes |
private AnimatorSet buildMenuAnimation(View target, float alpha) { AnimatorSet alphaAnimation = new AnimatorSet(); alphaAnimation.playTogether(ObjectAnimator.ofFloat(target, "alpha", alpha)); alphaAnimation.setDuration(130); // 250 return alphaAnimation; }
Example 9
Source File: ResideMenu.java From Libraries-for-Android-Developers with MIT License | 5 votes |
/** * a helper method to build scale up animation; * * @param target * @param targetScaleX * @param targetScaleY * @return */ private AnimatorSet buildScaleUpAnimation(View target,float targetScaleX,float targetScaleY){ AnimatorSet scaleUp = new AnimatorSet(); scaleUp.playTogether( ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY) ); scaleUp.setDuration(250); return scaleUp; }
Example 10
Source File: AnimateAdditionAdapter.java From ListViewAnimations with Apache License 2.0 | 5 votes |
@Override @NonNull public View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent) { final View view = super.getView(position, convertView, parent); if (mInsertQueue.getActiveIndexes().contains(position)) { int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.MATCH_PARENT, View.MeasureSpec.AT_MOST); int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.WRAP_CONTENT, View.MeasureSpec.UNSPECIFIED); view.measure(widthMeasureSpec, heightMeasureSpec); int originalHeight = view.getMeasuredHeight(); ValueAnimator heightAnimator = ValueAnimator.ofInt(1, originalHeight); heightAnimator.addUpdateListener(new HeightUpdater(view)); Animator[] customAnimators = getAdditionalAnimators(view, parent); Animator[] animators = new Animator[customAnimators.length + 1]; animators[0] = heightAnimator; System.arraycopy(customAnimators, 0, animators, 1, customAnimators.length); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(animators); ViewHelper.setAlpha(view, 0); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1); AnimatorSet allAnimatorsSet = new AnimatorSet(); allAnimatorsSet.playSequentially(animatorSet, alphaAnimator); allAnimatorsSet.setDuration(mInsertionAnimationDurationMs); allAnimatorsSet.addListener(new ExpandAnimationListener(position)); allAnimatorsSet.start(); } return view; }
Example 11
Source File: VideoImageView.java From Studio with Apache License 2.0 | 5 votes |
private void nextAnimation() { AnimatorSet anim = new AnimatorSet(); if (scale) { anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1.5f, 1f), ObjectAnimator.ofFloat(this, "scaleY", 1.5f, 1f)); } else { anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1, 1.5f), ObjectAnimator.ofFloat(this, "scaleY", 1, 1.5f)); } anim.setDuration(10987); anim.addListener(this); anim.start(); scale = !scale; }
Example 12
Source File: MobileAdapter.java From AirFree-Client with GNU General Public License v3.0 | 5 votes |
private void addAnimation(View view) { float[] vaules = new float[]{0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.5f, 0.6f, 0.65f, 0.7f, 0.8f, 0.7f, 0.65f, 0.6f, 0.5f}; AnimatorSet set = new AnimatorSet(); set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules), ObjectAnimator.ofFloat(view, "scaleY", vaules)); set.setDuration(150); set.start(); }
Example 13
Source File: ResideMenu.java From AndroidResideMenu with MIT License | 5 votes |
private AnimatorSet buildMenuAnimation(View target, float alpha) { AnimatorSet alphaAnimation = new AnimatorSet(); alphaAnimation.playTogether( ObjectAnimator.ofFloat(target, "alpha", alpha) ); alphaAnimation.setDuration(250); return alphaAnimation; }
Example 14
Source File: SwipeTouchListener.java From ListViewAnimations with Apache License 2.0 | 5 votes |
/** * Animates the pending {@link android.view.View} back to its original position. */ private void restoreCurrentViewTranslation() { if (mCurrentView == null) { return; } ObjectAnimator xAnimator = ObjectAnimator.ofFloat(mSwipingView, TRANSLATION_X, 0); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mSwipingView, ALPHA, 1); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(xAnimator, alphaAnimator); animatorSet.setDuration(mAnimationTime); animatorSet.addListener(new RestoreAnimatorListener(mCurrentView, mCurrentPosition)); animatorSet.start(); }
Example 15
Source File: DocumentAdapter.java From AirFree-Client with GNU General Public License v3.0 | 5 votes |
private void addAnimation(View view) { float[] vaules = new float[]{0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.5f, 0.6f, 0.65f, 0.7f, 0.8f, 0.7f, 0.65f, 0.6f, 0.5f}; AnimatorSet set = new AnimatorSet(); set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules), ObjectAnimator.ofFloat(view, "scaleY", vaules)); set.setDuration(150); set.start(); }
Example 16
Source File: PicSelectAdapter.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
/** * @param view */ private void addAnimation(View view) { float[] vaules = new float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.25f, 1.2f, 1.15f, 1.1f, 1.0f}; AnimatorSet set = new AnimatorSet(); set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules), ObjectAnimator.ofFloat(view, "scaleY", vaules)); set.setDuration(150); set.start(); }
Example 17
Source File: EmoticonsIndicatorView.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
private AnimatorSet getAnimPointOut(ImageView imageViewStrat) { ObjectAnimator anim1 = ObjectAnimator.ofFloat(imageViewStrat, "scaleX", 1.0f, 0.25f); ObjectAnimator anim2 = ObjectAnimator.ofFloat(imageViewStrat, "scaleY", 1.0f, 0.25f); mPlayByOutAnimatorSet = new AnimatorSet(); mPlayByOutAnimatorSet.play(anim1).with(anim2); mPlayByOutAnimatorSet.setDuration(100); return mPlayByInAnimatorSet; }
Example 18
Source File: ScaleAnimater.java From JPTabBar with Apache License 2.0 | 5 votes |
@Override public void onSelectChanged(View v,boolean selected) { AnimatorSet scaleAnimator = new AnimatorSet(); float end = selected?1.2f:1f; ObjectAnimator scaleX ; ObjectAnimator scaleY; scaleX = ObjectAnimator.ofFloat(v,"scaleX",end); scaleY = ObjectAnimator.ofFloat(v,"scaleY",end); scaleAnimator.playTogether(scaleX,scaleY); scaleAnimator.setDuration(300); scaleAnimator.start(); }
Example 19
Source File: ResideMenu.java From iSCAU-Android with GNU General Public License v3.0 | 5 votes |
/** * a helper method to build scale up animation; * * @param target * @param targetScaleX * @param targetScaleY * @return */ private AnimatorSet buildScaleUpAnimation(View target,float targetScaleX,float targetScaleY){ AnimatorSet scaleUp = new AnimatorSet(); scaleUp.playTogether( ObjectAnimator.ofFloat(target, "scaleX", targetScaleX), ObjectAnimator.ofFloat(target, "scaleY", targetScaleY) ); scaleUp.setDuration(250); return scaleUp; }
Example 20
Source File: CellViewHolder.java From MaterialLeanBack with Apache License 2.0 | 5 votes |
public void enlarge(boolean withAnimation) { if (!enlarged && settings.animateCards) { if (currentAnimator != null) { currentAnimator.cancel(); currentAnimator = null; } int duration = withAnimation ? 300 : 0; adapter.itemPosition = getAdapterPosition(); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(duration); List<Animator> animatorList = new ArrayList<>(); animatorList.add(ObjectAnimator.ofFloat(cardView, "scaleX", scaleEnlarged)); animatorList.add(ObjectAnimator.ofFloat(cardView, "scaleY", scaleEnlarged)); if (settings.overlapCards) { //animatorList.add(ObjectAnimator.ofFloat(cardView, "translationX", translationX)); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { cardView.setCardElevation(settings.elevationEnlarged); currentAnimator = null; } }); } animatorSet.playTogether(animatorList); currentAnimator = animatorSet; animatorSet.start(); enlarged = true; } }