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


Java Keyframe类代码示例

本文整理汇总了Java中android.animation.Keyframe的典型用法代码示例。如果您正苦于以下问题:Java Keyframe类的具体用法?Java Keyframe怎么用?Java Keyframe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getPulseAnimator

import android.animation.Keyframe; //导入依赖的package包/类
/**
 * Render an animator to pulsate a view in place.
 *
 * @param labelToAnimate the view to pulsate.
 * @return The animator object. Use .start() to begin.
 */
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio,
                                              float increaseRatio) {
    Keyframe k0 = Keyframe.ofFloat(0f, 1f);
    Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
    Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
    Keyframe k3 = Keyframe.ofFloat(1f, 1f);

    @SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
    @SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
    ObjectAnimator pulseAnimator =
            ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
    pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);

    return pulseAnimator;
}
 
开发者ID:ttpho,项目名称:TimePicker,代码行数:22,代码来源:Utils.java

示例2: getDisappearAnimator

import android.animation.Keyframe; //导入依赖的package包/类
public ObjectAnimator getDisappearAnimator() {
    if (!mIsInitialized || !mDrawValuesReady) {
        Log.e(TAG, "RadialSelectorView was not ready for animation.");
        return null;
    }

    Keyframe kf0, kf1, kf2;
    float midwayPoint = 0.2f;
    int duration = 500;

    kf0 = Keyframe.ofFloat(0f, 1);
    kf1 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
    kf2 = Keyframe.ofFloat(1f, mTransitionEndRadiusMultiplier);
    PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe(
            "animationRadiusMultiplier", kf0, kf1, kf2);

    kf0 = Keyframe.ofFloat(0f, 1f);
    kf1 = Keyframe.ofFloat(1f, 0f);
    PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1);

    ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
            this, radiusDisappear, fadeOut).setDuration(duration);
    disappearAnimator.addUpdateListener(mInvalidateUpdateListener);

    return disappearAnimator;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:27,代码来源:RadialSelectorView.java

示例3: getPulseAnimator

import android.animation.Keyframe; //导入依赖的package包/类
/**
 * Render an animator to pulsate a view in place.
 * @param labelToAnimate the view to pulsate.
 * @return The animator object. Use .start() to begin.
 */
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio,
        float increaseRatio) {
    Keyframe k0 = Keyframe.ofFloat(0f, 1f);
    Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
    Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
    Keyframe k3 = Keyframe.ofFloat(1f, 1f);

    PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
    ObjectAnimator pulseAnimator =
            ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
    pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);

    return pulseAnimator;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:21,代码来源:Utils.java

示例4: nope

import android.animation.Keyframe; //导入依赖的package包/类
public static ObjectAnimator nope(View view) {
    int delta = view.getResources().getDimensionPixelOffset(R.dimen.height_16px);

    PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X,
            Keyframe.ofFloat(0f, 0),
            Keyframe.ofFloat(.10f, -delta),
            Keyframe.ofFloat(.26f, delta),
            Keyframe.ofFloat(.42f, -delta),
            Keyframe.ofFloat(.58f, delta),
            Keyframe.ofFloat(.74f, -delta),
            Keyframe.ofFloat(.90f, delta),
            Keyframe.ofFloat(1f, 0f)
    );

    return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateX).
            setDuration(500);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:18,代码来源:ShakeListenerUtils.java

示例5: getReappearAnimator

import android.animation.Keyframe; //导入依赖的package包/类
public ObjectAnimator getReappearAnimator() {
    if (this.mIsInitialized && this.mDrawValuesReady) {
        int totalDuration = (int) (((float) 500) * (1.0f + ChartZoomer.ZOOM_AMOUNT));
        float delayPoint = (((float) 500) * ChartZoomer.ZOOM_AMOUNT) / ((float) totalDuration);
        float midwayPoint = 1.0f - ((1.0f - delayPoint) * 0.2f);
        Keyframe kf0 = Keyframe.ofFloat(0.0f, this.mTransitionEndRadiusMultiplier);
        Keyframe kf1 = Keyframe.ofFloat(delayPoint, this.mTransitionEndRadiusMultiplier);
        Keyframe kf2 = Keyframe.ofFloat(midwayPoint, this.mTransitionMidRadiusMultiplier);
        Keyframe kf3 = Keyframe.ofFloat(1.0f, 1.0f);
        PropertyValuesHolder radiusReappear = PropertyValuesHolder.ofKeyframe
                ("animationRadiusMultiplier", new Keyframe[]{kf0, kf1, kf2, kf3});
        kf0 = Keyframe.ofFloat(0.0f, 0.0f);
        kf1 = Keyframe.ofFloat(delayPoint, 0.0f);
        kf2 = Keyframe.ofFloat(1.0f, 1.0f);
        PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", new
                Keyframe[]{kf0, kf1, kf2});
        ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(this, new
                PropertyValuesHolder[]{radiusReappear, fadeIn}).setDuration((long) totalDuration);
        reappearAnimator.addUpdateListener(this.mInvalidateUpdateListener);
        return reappearAnimator;
    }
    Log.e(TAG, "RadialSelectorView was not ready for animation.");
    return null;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:RadialSelectorView.java

示例6: startIntroTextAnimation

import android.animation.Keyframe; //导入依赖的package包/类
private void startIntroTextAnimation() {
    if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Animator introAnimator = AnimatorInflater.loadAnimator(this, R.animator.intro);
        introAnimator.setTarget(introTextView);
        introAnimator.start();
    } else {
        Keyframe kf0 = Keyframe.ofFloat(0f, 0);
        Keyframe kf1 = Keyframe.ofFloat(.2f, 1);
        Keyframe kf2 = Keyframe.ofFloat(.9f, 1);
        Keyframe kf3 = Keyframe.ofFloat(1f, 0);
        PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2, kf3);
        ObjectAnimator alphaAnimator = ObjectAnimator.ofPropertyValuesHolder(introTextView, pvh);
        alphaAnimator.setInterpolator(new DecelerateInterpolator());
        alphaAnimator.setDuration(6000).setStartDelay(1000);
        alphaAnimator.start();
    }
}
 
开发者ID:Manabu-GT,项目名称:StarWarsOpening,代码行数:18,代码来源:OpeningActivity.java

示例7: startLogoAnimation

import android.animation.Keyframe; //导入依赖的package包/类
private void startLogoAnimation() {
    if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Animator logoAnimator = AnimatorInflater.loadAnimator(this, R.animator.logo);
        logoAnimator.setTarget(logoView);
        logoAnimator.start();
    } else {
        AnimatorSet animatorSet = new AnimatorSet();
        PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("alpha",
                Keyframe.ofFloat(0f, 1),
                Keyframe.ofFloat(.5f, 1),
                Keyframe.ofFloat(1f, 0));
        ObjectAnimator alphaAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        pvh = PropertyValuesHolder.ofKeyframe("scaleX", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
        ObjectAnimator scaleXAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        pvh = PropertyValuesHolder.ofKeyframe("scaleY", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
        ObjectAnimator scaleYAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        animatorSet.setInterpolator(new DecelerateInterpolator());
        animatorSet.setDuration(9000).setStartDelay(9000);
        animatorSet.playTogether(alphaAnimator, scaleXAnimator, scaleYAnimator);
        animatorSet.start();
    }
}
 
开发者ID:Manabu-GT,项目名称:StarWarsOpening,代码行数:26,代码来源:OpeningActivity.java

示例8: getFadeInAnimator

import android.animation.Keyframe; //导入依赖的package包/类
private static ObjectAnimator getFadeInAnimator(IntHolder target, int startAlpha, int endAlpha,
                                                InvalidateUpdateListener updateListener) {
    final float delayMultiplier = 0.25f;
    final float transitionDurationMultiplier = 1f;
    final float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
    final int totalDuration = (int) (FADE_IN_DURATION * totalDurationMultiplier);
    final float delayPoint = (delayMultiplier * FADE_IN_DURATION) / totalDuration;

    final Keyframe kf0, kf1, kf2;
    kf0 = Keyframe.ofInt(0f, startAlpha);
    kf1 = Keyframe.ofInt(delayPoint, startAlpha);
    kf2 = Keyframe.ofInt(1f, endAlpha);
    final PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("value", kf0, kf1, kf2);

    final ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(target, fadeIn);
    animator.setDuration(totalDuration);
    animator.addUpdateListener(updateListener);
    return animator;
}
 
开发者ID:andela-kogunde,项目名称:CheckSmarter,代码行数:20,代码来源:RadialTimePickerView.java

示例9: getAvatarAnimation

import android.animation.Keyframe; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private ObjectAnimator getAvatarAnimation(View view, int millis) {
    PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
            Keyframe.ofFloat(0f, 0.01f),
            Keyframe.ofFloat(.035f, 0.45f),
            Keyframe.ofFloat(.07f, 1.1f),
            Keyframe.ofFloat(.09f, 1f),
            Keyframe.ofFloat(.93f, .9f),
            Keyframe.ofFloat(1f, 0f)
    );

    PropertyValuesHolder pvhScaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y,
            Keyframe.ofFloat(0f, 0.01f),
            Keyframe.ofFloat(.035f, 0.45f),
            Keyframe.ofFloat(.07f, 1.1f),
            Keyframe.ofFloat(.09f, 1f),
            Keyframe.ofFloat(.93f, .9f),
            Keyframe.ofFloat(1f, 0f)
    );

    return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY).
            setDuration(millis);
}
 
开发者ID:Aracem,项目名称:android-complex-animation,代码行数:24,代码来源:PostAJobAnimatedView.java

示例10: fail

import android.animation.Keyframe; //导入依赖的package包/类
private void fail() {

        loginBtn.setEnabled(true);
        int delta = mOctocat.getResources().getDimensionPixelOffset(R.dimen.spacing_medium);
        PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X,
                Keyframe.ofFloat(0f, 0),
                Keyframe.ofFloat(.10f, -delta),
                Keyframe.ofFloat(.26f, delta),
                Keyframe.ofFloat(.42f, -delta),
                Keyframe.ofFloat(.58f, delta),
                Keyframe.ofFloat(.74f, -delta),
                Keyframe.ofFloat(.90f, delta),
                Keyframe.ofFloat(1f, 0f)
        );
        ObjectAnimator.ofPropertyValuesHolder(mOctocat, pvhTranslateX)
                .setDuration(500).start();
    }
 
开发者ID:huanglizhuo,项目名称:GitPath,代码行数:18,代码来源:LoginActivity.java

示例11: onClick

import android.animation.Keyframe; //导入依赖的package包/类
@Override
public void onClick(final View button) {
    button.setEnabled(false);
    View icon = findViewById(R.id.icon);

    Keyframe keyframe1 = Keyframe.ofFloat(0f, 0f);
    Keyframe keyframe2 = Keyframe.ofFloat(.4f, 90f);
    Keyframe keyframe3 = Keyframe.ofFloat(.6f, 90f);
    Keyframe keyframe4 = Keyframe.ofFloat(1f, 0f);
    PropertyValuesHolder propertyValuesHolder = PropertyValuesHolder.ofKeyframe("rotation", keyframe1, keyframe2, keyframe3, keyframe4);
    ObjectAnimator rotationAnim = ObjectAnimator.ofPropertyValuesHolder(icon, propertyValuesHolder);
    rotationAnim.setDuration(5000);
    rotationAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            button.setEnabled(true);
        }
    });
    rotationAnim.setInterpolator(new AccelerateDecelerateInterpolator());
    rotationAnim.start();
}
 
开发者ID:IanGClifton,项目名称:auid2,代码行数:22,代码来源:MainActivity.java

示例12: getPulseAnimator

import android.animation.Keyframe; //导入依赖的package包/类
/**
 * Render an animator to pulsate a view in place.
 *
 * @param labelToAnimate the view to pulsate.
 * @return The animator object. Use .start() to begin.
 */
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio,
                                              float increaseRatio) {
    Keyframe k0 = Keyframe.ofFloat(0f, 1f);
    Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
    Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
    Keyframe k3 = Keyframe.ofFloat(1f, 1f);

    PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
    ObjectAnimator pulseAnimator =
            ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY);
    pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);

    return pulseAnimator;
}
 
开发者ID:leavjenn,项目名称:SmoothDateRangePicker,代码行数:22,代码来源:Utils.java

示例13: nopeAnimation

import android.animation.Keyframe; //导入依赖的package包/类
/**
 * Credit goes to Cyril Mottier.
 * https://plus.google.com/+CyrilMottier/posts/FABaJhRMCuy
 *
 * @param view the {@link View} to animate.
 * @return an {@link ObjectAnimator} that will play a 'nope' animation.
 */
public static ObjectAnimator nopeAnimation(View view, int delta) {
    PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X,
            Keyframe.ofFloat(0f, 0),
            Keyframe.ofFloat(.10f, -delta),
            Keyframe.ofFloat(.26f, delta),
            Keyframe.ofFloat(.42f, -delta),
            Keyframe.ofFloat(.58f, delta),
            Keyframe.ofFloat(.74f, -delta),
            Keyframe.ofFloat(.90f, delta),
            Keyframe.ofFloat(1f, 0f)
    );

    return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateX).
            setDuration(500);
}
 
开发者ID:tvbarthel,项目名称:CameraColorPicker,代码行数:23,代码来源:Views.java

示例14: getFadeInAnimator

import android.animation.Keyframe; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static ObjectAnimator getFadeInAnimator(IntHolder target, int startAlpha, int endAlpha,
                                                InvalidateUpdateListener updateListener) {
    final float delayMultiplier = 0.25f;
    final float transitionDurationMultiplier = 1f;
    final float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
    final int totalDuration = (int) (FADE_IN_DURATION * totalDurationMultiplier);
    final float delayPoint = (delayMultiplier * FADE_IN_DURATION) / totalDuration;

    final Keyframe kf0, kf1, kf2;
    kf0 = Keyframe.ofInt(0f, startAlpha);
    kf1 = Keyframe.ofInt(delayPoint, startAlpha);
    kf2 = Keyframe.ofInt(1f, endAlpha);
    final PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("value", kf0, kf1, kf2);

    final ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(target, fadeIn);
    animator.setDuration(totalDuration);
    animator.addUpdateListener(updateListener);
    return animator;
}
 
开发者ID:TR4Android,项目名称:AppCompat-Extension-Library,代码行数:21,代码来源:RadialTimePickerView.java

示例15: getPulseAnimator

import android.animation.Keyframe; //导入依赖的package包/类
public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio,
    float increaseRatio) {
  Keyframe k0 = Keyframe.ofFloat(0f, 1f);
  Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
  Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
  Keyframe k3 = Keyframe.ofFloat(1f, 1f);

  PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe("scaleX", k0, k1, k2, k3);
  PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe("scaleY", k0, k1, k2, k3);
  ObjectAnimator pulseAnimator =
      ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX,
          scaleY);
  pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION);

  return pulseAnimator;
}
 
开发者ID:novachevskyi,项目名称:material-calendar-datepicker,代码行数:17,代码来源:Utils.java


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