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


Java ValueAnimator.start方法代码示例

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


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

示例1: setCodeSegment

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void setCodeSegment(final TextView codeView, String segment) {
  if (Build.VERSION.SDK_INT >= 11) {
    ValueAnimator valueAnimator = new ValueAnimator();
    valueAnimator.setObjectValues(0, Integer.parseInt(segment));

    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
      @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
      @Override
      public void onAnimationUpdate(ValueAnimator animation) {
        int value = (int) animation.getAnimatedValue();
        codeView.setText(String.format("%05d", value));
      }
    });

    valueAnimator.setEvaluator(new TypeEvaluator<Integer>() {
      public Integer evaluate(float fraction, Integer startValue, Integer endValue) {
        return Math.round(startValue + (endValue - startValue) * fraction);
      }
    });

    valueAnimator.setDuration(1000);
    valueAnimator.start();
  } else {
    codeView.setText(segment);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:27,代码来源:VerifyIdentityActivity.java

示例2: onFinish

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public int onFinish(@NonNull RefreshLayout layout, boolean success) {
    mShowOuter = false;
    mShowBoll = false;
    ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mFinishRatio = (float) animation.getAnimatedValue();
            BezierCircleHeader.this.invalidate();
        }
    });
    animator.setInterpolator(new AccelerateInterpolator());
    animator.setDuration(DURATION_FINISH);
    animator.start();
    return DURATION_FINISH;
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:18,代码来源:BezierCircleHeader.java

示例3: startColorGradientAnim

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static void startColorGradientAnim(int duration, final View view, @Nullable Animator.AnimatorListener listener, int... values) {
    final ValueAnimator anim = ObjectAnimator.ofArgb(values);
    anim.setDuration(duration);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int va = (int) animation.getAnimatedValue();
            view.setBackgroundColor(va);
        }
    });
    if (listener != null) {
        anim.addListener(listener);
    }
    anim.start();
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:17,代码来源:AnimationUtils.java

示例4: setUpAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override public void setUpAnimation() {
  for (int i = 0; i < circlesSize; i++) {
    final int index = i;

    ValueAnimator fadeAnimator = ValueAnimator.ofInt(126, 255, 126);
    fadeAnimator.setRepeatCount(ValueAnimator.INFINITE);
    fadeAnimator.setDuration(1000);
    fadeAnimator.setStartDelay(index * 120);
    fadeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
      @Override public void onAnimationUpdate(ValueAnimator animation) {
        circles[index].setAlpha((int)animation.getAnimatedValue());
        if (invalidateListener != null) {
          invalidateListener.reDraw();
        }
      }
    });

    fadeAnimator.start();
  }
}
 
开发者ID:nntuyen,项目名称:mkloader,代码行数:21,代码来源:ClassicSpinner.java

示例5: animateShadeClose

import android.animation.ValueAnimator; //导入方法依赖的package包/类
void animateShadeClose() {
    this.phone.performHapticFeedback(3, 2);
    updateText(this.explanation, R.string.oob_pullout_shade_all_the_way, 0, null);
    final float dimIncrement = this.dimValue / ((float) this.shadeHeight);
    float currentHeight = (float) this.shade.getHeight();
    ValueAnimator va = ValueAnimator.ofInt(new int[]{(int) currentHeight, 0});
    va.addUpdateListener(new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer height = (Integer) animation.getAnimatedValue();
            LayoutParams layoutParams = OOBTutorialActivity.this.shade.getLayoutParams();
            layoutParams.height = height.intValue();
            OOBTutorialActivity.this.shade.setLayoutParams(layoutParams);
            OOBTutorialActivity.this.dim.setAlpha(height.floatValue() * dimIncrement);
            OOBTutorialActivity.this.shade.requestLayout();
        }
    });
    va.start();
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:19,代码来源:OOBTutorialActivity.java

示例6: animateToolbar

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void animateToolbar(final float toY) {
    float layoutTranslationY = ViewCompat.getTranslationY(mInterceptionLayout);
    if (layoutTranslationY != toY) {
        ValueAnimator animator = ValueAnimator.ofFloat(ViewCompat.getTranslationY(mInterceptionLayout), toY).setDuration(200);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float translationY = (float) animation.getAnimatedValue();
                View tView = adjustmentToolBarView();
                ViewCompat.setTranslationY(mInterceptionLayout, translationY);
                ViewCompat.setTranslationY(tView, translationY);
                if (translationY < 0) {
                    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
                    lp.height = (int) (-translationY + getScreenHeight());
                    mInterceptionLayout.requestLayout();
                }
            }
        });
        animator.start();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:ViewPagerTabFragmentParentFragment.java

示例7: createAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{500,250,0,250,500};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
        scaleAnim.setDuration(900);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:magicbaby810,项目名称:SRecyclerView,代码行数:23,代码来源:LineScalePulseOutIndicator.java

示例8: startAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void startAnimation() {

        ValueAnimator valueAnimator = ValueAnimator.ofInt(0,mBitmapDST.getWidth());
        valueAnimator.setInterpolator(new LinearInterpolator());
        valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
        valueAnimator.setDuration(5000);
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                dx = (int) animation.getAnimatedValue();
                postInvalidate();
            }
        });

        valueAnimator.start();

    }
 
开发者ID:fanxiaole,项目名称:MyXferModeDemo,代码行数:18,代码来源:ECGView.java

示例9: showHeight

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public static void showHeight(final View view,float  start,float end){
    final ValueAnimator animator=ValueAnimator.ofFloat(start,end);
    final ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float value = (Float) animator.getAnimatedValue();
            layoutParams.height=(int) value;
            view.setLayoutParams(layoutParams);
            Log.i(TAG, "onAnimationUpdate: value="+value);

        }
    });
    animator.setDuration(500);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();
}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:18,代码来源:AnimatorUtil.java

示例10: slowSmoothScrollTo

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/** slower than smoothScrollTo */
private void slowSmoothScrollTo(final ScrollView parentScrollView, int scrollY, int autoScrollAnimationTime) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ValueAnimator realSmoothScrollAnimation =
                ValueAnimator.ofInt(parentScrollView.getScrollY(), scrollY);
        realSmoothScrollAnimation.setDuration(autoScrollAnimationTime);
        realSmoothScrollAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                int scrollTo = (Integer) animation.getAnimatedValue();
                parentScrollView.scrollTo(0, scrollTo);
            }
        });

        realSmoothScrollAnimation.start();
    } else {
        parentScrollView.smoothScrollTo(0, scrollY);
    }
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:20,代码来源:SeeScoreView.java

示例11: onClick

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@OnClick(R.id.grow)
public void onClick() {
    ValueAnimator valueAnimator=new ValueAnimator().ofObject(new StudentEvaluator(),new Student(0,40),new Student(100,300));
    valueAnimator.setDuration(5000);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Student student = (Student) animation.getAnimatedValue();
            info.setText("学生年龄:"+student.getAge()+"岁,学生身高:"+student.getHeight()+"cm");
        }
    });
valueAnimator.start();
}
 
开发者ID:flyou,项目名称:PropertyAnimatorDemo,代码行数:14,代码来源:EvaluatorActivity.java

示例12: startRotate

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void startRotate() {
    ValueAnimator animator = ValueAnimator.ofInt(0,360);
    animator.setDuration(2000);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mDegrees = (int) animation.getAnimatedValue();
            invalidate();
        }
    });
    animator.start();
}
 
开发者ID:jiangkang,项目名称:KTools,代码行数:15,代码来源:TaiChiView.java

示例13: startSuccessSymbolAnim

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 开始加载成功动画
 */
private void startSuccessSymbolAnim() {
    currentPath.reset();
    pathMeasure.setPath(successSymbolPath, false);
    pathMeasure.getPosTan(0, mCurrentPosition, null);
    currentPath.moveTo(mCurrentPosition[0], mCurrentPosition[1]);

    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, pathMeasure.getLength());
    valueAnimator.setDuration(500);
    // 减速插值器
    valueAnimator.setInterpolator(new DecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            if (isLoading)
                return;
            float value = (Float) animation.getAnimatedValue();
            // 获取当前点坐标封装到mCurrentPosition
            float[] tmp = mCurrentPosition;
            pathMeasure.getPosTan(value, mCurrentPosition, null);
            currentPath.quadTo(tmp[0], tmp[1], mCurrentPosition[0], mCurrentPosition[1]);
            invalidateCallback.redraw();
        }
    });
    valueAnimator.start();
}
 
开发者ID:CuiZhaoHui,项目名称:LoadingViews,代码行数:30,代码来源:ChaseLoading.java

示例14: imageColorChange

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public static void imageColorChange(final ImageView image, int fromColor, int toColor) {
    ValueAnimator imageColorChangeAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor);
    imageColorChangeAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            image.setColorFilter((Integer) animator.getAnimatedValue());
        }
    });
    imageColorChangeAnimation.setDuration(150);
    imageColorChangeAnimation.start();
}
 
开发者ID:shenhuanet,项目名称:OpenEyesReading-android,代码行数:12,代码来源:BottomTabUtils.java

示例15: animateInHorizontal

import android.animation.ValueAnimator; //导入方法依赖的package包/类
void animateInHorizontal() {
    ValueAnimator animator = ValueAnimator.ofFloat(0.0f, getHeight());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            pathIn = new Path();
            pathIn.moveTo(0.0f, (Float) valueAnimator.getAnimatedValue() - paint.getFontMetrics().bottom);
            pathIn.lineTo(getWidth(), (Float) valueAnimator.getAnimatedValue() - paint.getFontMetrics().bottom);
            rotatable.setPathIn(pathIn);
        }
    });
    animator.setInterpolator(rotatable.getInterpolator());
    animator.setDuration(rotatable.getAnimationDuration());
    animator.start();
}
 
开发者ID:sdsmdg,项目名称:RotatingText,代码行数:16,代码来源:RotatingTextSwitcher.java


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