当前位置: 首页>>代码示例>>Java>>正文


Java ValueAnimator.ofInt方法代码示例

本文整理汇总了Java中com.nineoldandroids.animation.ValueAnimator.ofInt方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.ofInt方法的具体用法?Java ValueAnimator.ofInt怎么用?Java ValueAnimator.ofInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.nineoldandroids.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.ofInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTouchEvent

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_UP) {
        // 恢复高度
        final ValueAnimator animator = ValueAnimator.ofInt(parallaxImageView.getHeight(), originalHeight);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                Integer animateValue = (Integer) animator.getAnimatedValue();
                // 给 ImageView 设置值
                parallaxImageView.getLayoutParams().height = animateValue;
                parallaxImageView.requestLayout();
            }
        });
        animator.setInterpolator(new OvershootInterpolator()); // 弹性差值器
        animator.setDuration(450);
        animator.start();
    }
    return super.onTouchEvent(ev);
}
 
开发者ID:sleticalboy,项目名称:CustomWeight,代码行数:21,代码来源:ParallaxListView.java

示例2: dropTempWindow

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
private void dropTempWindow() {
    mInputBox.setVisibility(View.INVISIBLE);
    ValueAnimator va = ValueAnimator.ofInt(mEnterLayoutAnimSupportContainer.softkeyboardOpenY, mEnterLayoutAnimSupportContainer.openY);
    va.setDuration(300);
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int y = (int) animation.getAnimatedValue();
            int b = (y - mEnterLayoutAnimSupportContainer.softkeyboardOpenY) * panelHeight / (mEnterLayoutAnimSupportContainer.openY - mEnterLayoutAnimSupportContainer.softkeyboardOpenY) - panelHeight;
            moveTempWindow(y);
            updateEnterLayoutBottom(b);
            if (y == mEnterLayoutAnimSupportContainer.openY) {
                removeTempWindow();
                mInputBox.setVisibility(View.VISIBLE);
            }
        }
    });
    va.start();

}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:21,代码来源:EnterEmojiLayout.java

示例3: createHeightAnimator

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public static ValueAnimator createHeightAnimator(final View view, final int start, final int end) {
    ValueAnimator animator = ValueAnimator.ofInt(start, end);
    animator.addUpdateListener(
            new ValueAnimator.AnimatorUpdateListener() {

                @Override
                public void onAnimationUpdate(final ValueAnimator animation) {
                    int value = (Integer) animation.getAnimatedValue();

                    LayoutParams layoutParams = view.getLayoutParams();
                    layoutParams.height = value;
                    view.setLayoutParams(layoutParams);
                }
            }
    );
    return animator;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:18,代码来源:ExpandableListItemAdapter.java

示例4: animateCirlce

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * Internal void to start the circles animation.
 * <p>
 * when this void is called the circles radius would be updated by a
 * {@link ValueAnimator} and then it will call the {@link View}'s
 * invalidate() void witch calls the onDraw void each time so a bigger
 * circle would be drawn each time till the cirlce's fill the whole screen.
 * </p>
 */
private void animateCirlce() {
	if (circles_fill_type == CIRLCES_FILL_HEIGHT_TYPE) {
		circle_max_radius = screen_height + (screen_height / 4);
	} else {
		circle_max_radius = screen_width + (screen_width / 4);
	}
	ValueAnimator va = ValueAnimator.ofInt(0, circle_max_radius / 3);
	va.setDuration(1000);
	va.addListener(this);
	va.setInterpolator(new AccelerateInterpolator());
	va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		public void onAnimationUpdate(ValueAnimator animation) {
			int value = (int) animation.getAnimatedValue();
			circle_radius = value * 3;
			invalidate();
		}
	});
	va.start();
}
 
开发者ID:Mahfa,项目名称:AndroidColorPop,代码行数:29,代码来源:PopBackgroundView.java

示例5: animateRect

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * Internal void to start the rectangle animation.
 * <p>
 * when this void is called the space at the top of the rectangle would be
 * updated by a {@link ValueAnimator} and then it will call the {@link View}
 * 's invalidate() void witch calls the onDraw void each time so a bigger
 * rectangle would be drawn each time till the it the rectangles height is
 * enough
 * </p>
 */
private void animateRect() {
	ValueAnimator va = ValueAnimator.ofInt(rect_space_top / 2,
			screen_height / 2);
	va.setDuration(500);
	va.addListener(this);
	va.setInterpolator(new DecelerateInterpolator());
	va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		public void onAnimationUpdate(ValueAnimator animation) {
			int value = ((int) animation.getAnimatedValue()) * 2;
			int rect_top = -((value - rect_space_top) - screen_height);
			rect.top = rect_top;
			invalidate();
		}
	});
	va.start();
}
 
开发者ID:Mahfa,项目名称:AndroidColorPop,代码行数:27,代码来源:PopBackgroundView.java

示例6: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();

    int[] durations={960, 930, 1190, 1130, 1340, 940, 1200, 820, 1190};
    int[] delays= {360, 400, 680, 410, 710, -150, -120, 10, 320};

    for (int i = 0; i < 9; i++) {
        final int index=i;
        ValueAnimator alphaAnim=ValueAnimator.ofInt(255, 168,255);
        alphaAnim.setDuration(durations[i]);
        alphaAnim.setRepeatCount(-1);
        alphaAnim.setStartDelay(delays[i]);
        alphaAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                alphas[index] = (int) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        alphaAnim.start();
        animators.add(alphaAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:26,代码来源:BallGridBeatIndicator.java

示例7: performAnimate

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
private void performAnimate(final View target, final int start, final int end) {
    ValueAnimator valueAnimator = ValueAnimator.ofInt(1, 100);
    valueAnimator.addUpdateListener(new AnimatorUpdateListener() {

        // 持有一个IntEvaluator对象,方便下面估值的时候使用
        private IntEvaluator mEvaluator = new IntEvaluator();

        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            // 获得当前动画的进度值,整型,1-100之间
            int currentValue = (Integer) animator.getAnimatedValue();
            Log.d(TAG, "current value: " + currentValue);

            // 获得当前进度占整个动画过程的比例,浮点型,0-1之间
            float fraction = animator.getAnimatedFraction();
            // 直接调用整型估值器通过比例计算出宽度,然后再设给Button
            target.getLayoutParams().width = mEvaluator.evaluate(fraction, start, end);
            target.requestLayout();
        }
    });

    valueAnimator.setDuration(5000).start();
}
 
开发者ID:singwhatiwanna,项目名称:android-art-res,代码行数:24,代码来源:DemoActivity_1.java

示例8: getWidthAnimator

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
private Animator getWidthAnimator(final int from, final int to) {
  final ValueAnimator anim = ValueAnimator.ofInt(from, to);
  anim.addUpdateListener(new AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      final int val = (Integer)animation.getAnimatedValue();
      final ViewGroup.LayoutParams layoutParams = getLayoutParams();
      layoutParams.width = val;
      setLayoutParams(layoutParams);
    }
  });
  anim.setInterpolator(new FastOutSlowInInterpolator());
  anim.setDuration(TRANSITION_MS);
  return anim;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:16,代码来源:TransferControlView.java

示例9: getView

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@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;
}
 
开发者ID:sathishmscict,项目名称:ListViewAnimations,代码行数:37,代码来源:AnimateAdditionAdapter.java

示例10: createHeightAnimator

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public static ValueAnimator createHeightAnimator(final View view, final int start, final int end) {
    ValueAnimator animator = ValueAnimator.ofInt(start, end);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(final ValueAnimator valueAnimator) {
            int value = (Integer) valueAnimator.getAnimatedValue();

            ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
            layoutParams.height = value;
            view.setLayoutParams(layoutParams);
        }
    });
    return animator;
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:16,代码来源:ExpandableListItemAdapter.java

示例11: startChangeWholeHeaderViewPaddingTop

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public void startChangeWholeHeaderViewPaddingTop(int distance) {
    ValueAnimator animator = ValueAnimator.ofInt(mWholeHeaderView.getPaddingTop(), mWholeHeaderView.getPaddingTop() - distance);
    animator.setDuration(mRefreshViewHolder.getTopAnimDuration());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int paddingTop = (int) animation.getAnimatedValue();
            mWholeHeaderView.setPadding(0, paddingTop, 0, 0);
        }
    });
    animator.start();
}
 
开发者ID:DIY-green,项目名称:AndroidStudyDemo,代码行数:13,代码来源:BGARefreshLayout.java

示例12: hiddenRefreshHeaderView

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 隐藏下拉刷新控件,带动画
 */
private void hiddenRefreshHeaderView() {
    ValueAnimator animator = ValueAnimator.ofInt(mWholeHeaderView.getPaddingTop(), mMinWholeHeaderViewPaddingTop);
    animator.setDuration(mRefreshViewHolder.getTopAnimDuration());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int paddingTop = (int) animation.getAnimatedValue();
            mWholeHeaderView.setPadding(0, paddingTop, 0, 0);
        }
    });
    animator.start();
}
 
开发者ID:DIY-green,项目名称:AndroidStudyDemo,代码行数:16,代码来源:BGARefreshLayout.java

示例13: changeRefreshHeaderViewToZero

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 设置下拉刷新控件的paddingTop到0,带动画
 */
private void changeRefreshHeaderViewToZero() {
    ValueAnimator animator = ValueAnimator.ofInt(mWholeHeaderView.getPaddingTop(), 0);
    animator.setDuration(mRefreshViewHolder.getTopAnimDuration());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int paddingTop = (int) animation.getAnimatedValue();
            mWholeHeaderView.setPadding(0, paddingTop, 0, 0);
        }
    });
    animator.start();
}
 
开发者ID:DIY-green,项目名称:AndroidStudyDemo,代码行数:16,代码来源:BGARefreshLayout.java

示例14: setProgress

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
     * 设置进度,此为线程安全控件,由于考虑多线的问题,需要同步 刷新界面调用postInvalidate()能在非UI线程刷新
     *
     * @param progress
     */

    public synchronized void setProgress(int progress) {
        if (this.progress == progress) {
            return;
        }

//        hasShowing = true;
        if (progress < 0) {
//			throw new IllegalArgumentException("progress not less than 0");
            return;
        }
        if (progress > max) {
            progress = max;
        }
        ValueAnimator va = ValueAnimator.ofInt(this.progress, progress);
        va.setDuration(1000);
        va.setInterpolator(new AccelerateInterpolator());
        va.start();
        va.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator arg0) {
                int value = (Integer) arg0.getAnimatedValue();
                if (value <= max) {
                    RoundProgressBar.this.progress = value;
                    invalidate();
                }
            }
        });

    }
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:36,代码来源:RoundProgressBar.java

示例15: reduce

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public void reduce() {
    if (expanded) {

        ValueAnimator expand = ValueAnimator.ofInt(card.getHeight(), cardCollapsedHeight);
        expand.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                Integer value = (Integer) animation.getAnimatedValue();
                card.getLayoutParams().height = value.intValue();
                card.requestLayout();
            }
        });

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(ANIMATION_DURATION);
        animatorSet.playTogether(
                ObjectAnimator.ofFloat(label, "alpha", 1),
                ObjectAnimator.ofFloat(label, "scaleX", 1),
                ObjectAnimator.ofFloat(label, "scaleY", 1),
                ObjectAnimator.ofFloat(label, "translationY", 0),

                ObjectAnimator.ofFloat(image, "alpha", 0),
                ObjectAnimator.ofFloat(image, "scaleX", 0.4f),
                ObjectAnimator.ofFloat(image, "scaleY", 0.4f),

                ObjectAnimator.ofFloat(editText, "alpha", 0),
                expand
        );
        animatorSet.start();

        if (OPEN_KEYBOARD_ON_FOCUS)
            ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
        editText.clearFocus();

        expanded = false;
    }
}
 
开发者ID:13120241790,项目名称:MaterialDesginAM,代码行数:38,代码来源:MaterialTextField.java


注:本文中的com.nineoldandroids.animation.ValueAnimator.ofInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。