本文整理了Java中android.animation.ObjectAnimator.getDuration()
方法的一些代码示例,展示了ObjectAnimator.getDuration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator.getDuration()
方法的具体详情如下:
包路径:android.animation.ObjectAnimator
类名称:ObjectAnimator
方法名:getDuration
暂无
代码示例来源:origin: badoualy/stepper-indicator
lineAnimator.setInterpolator(new DecelerateInterpolator());
indicatorAnimator.setDuration(lineAnimator.getDuration() / 2);
checkAnimator.setDuration(lineAnimator.getDuration() / 2);
代码示例来源:origin: hujiaweibujidao/yava
@Override
public Number evaluate(float fraction, Number startValue, Number endValue) {
float t = animator1.getDuration() * fraction;//已经过去的时间
float b = startValue.floatValue();//起始值
float c = endValue.floatValue() - startValue.floatValue();//结束值与起始值之间的差值
float d = animator1.getDuration();//总的时间间隔,t/d 就是已经过去的时间占总时间间隔的比率
if ((t /= d) < (1 / 2.75f)) {
return c * (7.5625f * t * t) + b;
} else if (t < (2 / 2.75f)) {
return c * (7.5625f * (t -= (1.5f / 2.75f)) * t + .75f) + b;
} else if (t < (2.5 / 2.75)) {
return c * (7.5625f * (t -= (2.25f / 2.75f)) * t + .9375f) + b;
} else {
return c * (7.5625f * (t -= (2.625f / 2.75f)) * t + .984375f) + b;
}
}
});
代码示例来源:origin: Marksss/AndroidAutoSwitcher
@Override
public void operate(AutoSwitchView switcher, final ChainOperator operator) {
long delay = 0;
if (mAnimatorIn != null) {
mAnimatorIn.setTarget(switcher.getCurrentView());
mAnimatorIn.start();
delay = mAnimatorIn.getDuration();
}
if (mAnimatorOut != null) {
mAnimatorOut.setTarget(switcher.getPreviousView());
mAnimatorOut.start();
delay = delay > mAnimatorOut.getDuration() ? delay : mAnimatorOut.getDuration();
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
operator.showNextWithInterval(mInterval);
}
}, delay);
}
}).
代码示例来源:origin: stackoverflow.com
protected void randomizeTheButton(int animCount)
{
int delay = 0;
for(int i = 0; i < animCount; i++)
{
final ObjectAnimator colorAnim = ObjectAnimator.ofArgb(mButton, "backgroundColor", Color.argb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
colorAnim.setDuration(500);
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.setRepeatCount(0);
mHandler.postDelayed(new Runnable()
{
@Override
public void run()
{
colorAnim.start();
}
}, delay);
delay += colorAnim.getDuration();
}
}
代码示例来源:origin: rkkr/simple-keyboard
private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
final ObjectAnimator animatorToStart) {
if (animatorToCancel == null || animatorToStart == null) {
// TODO: Stop using null as a no-operation animator.
return;
}
float startFraction = 0.0f;
if (animatorToCancel.isStarted()) {
animatorToCancel.cancel();
startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
}
final long startTime = (long)(animatorToStart.getDuration() * startFraction);
animatorToStart.start();
animatorToStart.setCurrentPlayTime(startTime);
}
代码示例来源:origin: crvv/android_wubi_input
private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
final ObjectAnimator animatorToStart) {
if (animatorToCancel == null || animatorToStart == null) {
// TODO: Stop using null as a no-operation animator.
return;
}
float startFraction = 0.0f;
if (animatorToCancel.isStarted()) {
animatorToCancel.cancel();
startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
}
final long startTime = (long)(animatorToStart.getDuration() * startFraction);
animatorToStart.start();
animatorToStart.setCurrentPlayTime(startTime);
}
代码示例来源:origin: luhaoaimama1/zone-sdk
if (objAni.isRunning())
objAni.cancel();
objAni.setCurrentPlayTime(objAni.getDuration() / 2);
break;
代码示例来源:origin: googlesamples/android-play-places
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
Log.d(TAG, "onLayout: " + changed);
if( changed && !mLayouted ){
mLayouted = true;
ObjectAnimator animator;
LayoutTransition layoutTransition = new LayoutTransition();
animator = mAnimators.getDisappearingAnimator(getContext());
layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, animator);
animator = mAnimators.getAppearingAnimator(getContext());
layoutTransition.setAnimator(LayoutTransition.APPEARING, animator);
layoutTransition.addTransitionListener(mTransitionListener);
if( animator != null )
layoutTransition.setDuration(animator.getDuration());
setLayoutTransition(layoutTransition);
if( mShowInitialAnimation )
runInitialAnimations();
if (mFirstVisibleCardTag != null) {
scrollToCard(mFirstVisibleCardTag);
mFirstVisibleCardTag = null;
}
}
}
代码示例来源:origin: googlesamples/android-BatchStepSensor
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
Log.d(TAG, "onLayout: " + changed);
if( changed && !mLayouted ){
mLayouted = true;
ObjectAnimator animator;
LayoutTransition layoutTransition = new LayoutTransition();
animator = mAnimators.getDisappearingAnimator(getContext());
layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, animator);
animator = mAnimators.getAppearingAnimator(getContext());
layoutTransition.setAnimator(LayoutTransition.APPEARING, animator);
layoutTransition.addTransitionListener(mTransitionListener);
if( animator != null )
layoutTransition.setDuration(animator.getDuration());
setLayoutTransition(layoutTransition);
if( mShowInitialAnimation )
runInitialAnimations();
if (mFirstVisibleCardTag != null) {
scrollToCard(mFirstVisibleCardTag);
mFirstVisibleCardTag = null;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!