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


Java ObjectAnimator.ofFloat方法代码示例

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


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

示例1: onBind

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void onBind(Target view, Value o, final OnBindListener onBindListener) {
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, View.ROTATION, 0f, 10f);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, View.ROTATION_X, 0f, 90f);
    AnimatorSet set = new AnimatorSet();
    set.setInterpolator(new AccelerateInterpolator(2f));
    set.setDuration(300);
    set.setStartDelay(80 * count);
    set.playTogether(animatorX, animatorY);
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            onBindListener.onBindDone();
        }
    });
    set.start();
    count++;
}
 
开发者ID:sedstrom,项目名称:Witch-Android,代码行数:20,代码来源:FlipOut.java

示例2: showMenuView

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void showMenuView(){
    rlMenuView.setVisibility(View.VISIBLE);
    ObjectAnimator animator1 = ObjectAnimator.ofFloat(rlMenuView, "translationY", 100f, 0f);
    ObjectAnimator animator2 = ObjectAnimator.ofFloat(rlMenuView,"alpha",0f,1f);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(500);
    set.playTogether(animator1, animator2);
    set.start();

}
 
开发者ID:lai233333,项目名称:MyDemo,代码行数:11,代码来源:ImageManagerActivity.java

示例3: createShowUpAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public Animator createShowUpAnimator(final View target) {
    if (mHasCustomAnimationParams) {
        final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_X, mShowUpStartXScale,
                KEY_PREVIEW_SHOW_UP_END_SCALE);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
                target, View.SCALE_Y, mShowUpStartYScale,
                KEY_PREVIEW_SHOW_UP_END_SCALE);
        final AnimatorSet showUpAnimator = new AnimatorSet();
        showUpAnimator.play(scaleXAnimator).with(scaleYAnimator);
        showUpAnimator.setDuration(mShowUpDuration);
        showUpAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
        return showUpAnimator;
    }
    final Animator animator = AnimatorInflater.loadAnimator(
            target.getContext(), mShowUpAnimatorResId);
    animator.setTarget(target);
    animator.setInterpolator(DECELERATE_INTERPOLATOR);
    return animator;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:21,代码来源:KeyPreviewDrawParams.java

示例4: onExpansionToggled

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void onExpansionToggled(boolean expanded) {
    super.onExpansionToggled(expanded);
    ObjectAnimator imageViewObjectAnimator;
    if (expanded) { // rotate clockwise
         imageViewObjectAnimator = ObjectAnimator.ofFloat(mArrowExpandImageView ,
                View.ROTATION, ROTATED_POSITION,INITIAL_POSITION);

    } else { // rotate counterclockwise
         imageViewObjectAnimator = ObjectAnimator.ofFloat(mArrowExpandImageView ,
                View.ROTATION,INITIAL_POSITION, ROTATED_POSITION);
    }

    imageViewObjectAnimator.setDuration(1000);
    imageViewObjectAnimator.setInterpolator(new OvershootInterpolator());
    imageViewObjectAnimator.start();
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:18,代码来源:BookResultsHeaderViewHolder.java

示例5: showStartView

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * 显示最后一页的状态
 * @param position
 */
private void showStartView(int position) {
    // 最后一页
    if (position == mCount - 1) {
        if (mOpenView != null) {
            mOpenView.setVisibility(VISIBLE);
            ObjectAnimator animator = ObjectAnimator.ofFloat(mOpenView,
                    "alpha", 0, 1);
            animator.setDuration(500);
            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.start();
            if (mDismissOpen){
                setVisibility(View.GONE);
            }
        }
    } else {
        if (mOpenView != null) {

            mOpenView.setVisibility(GONE);

            if (mDismissOpen){
                setVisibility(VISIBLE);
            }
        }
    }
}
 
开发者ID:LillteZheng,项目名称:ViewPagerHelper,代码行数:30,代码来源:TextIndicator.java

示例6: setupTransitionSets

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void setupTransitionSets() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        shadowFadeOutAnimator = ObjectAnimator.ofFloat(emptyDropDownSpace, View.ALPHA, 0f);
        shadowFadeOutAnimator.setDuration(COLLAPSE_TRANSITION_DURATION);
        shadowFadeOutAnimator.setInterpolator(new AccelerateInterpolator());
        shadowFadeOutAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                emptyDropDownSpace.setVisibility(View.GONE);
                emptyDropDownSpace.setAlpha(1f);
            }
        });
        expandTransitionSet = createTransitionSet();
        collapseTransitionSet = createTransitionSet();
        collapseTransitionSet.setDuration(COLLAPSE_TRANSITION_DURATION);
    }
}
 
开发者ID:AnthonyFermin,项目名称:DropDownView,代码行数:19,代码来源:DropDownView.java

示例7: onCreate

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    user = (ClearEditText) findViewById(R.id.user);
    user.addTextChangedListener(userTextWatcher);
    user.setOnFocusChangeListener(this);

    pass = (ClearEditText) findViewById(R.id.pass);
    pass.setOnFocusChangeListener(this);
    pass.addTextChangedListener(passTextWatcher);

    login = (Button) findViewById(R.id.login);
    login.setOnClickListener(this);
    register = (Button) findViewById(R.id.register);
    register.setOnClickListener(this);
    forget = (TextView) findViewById(R.id.forget);

    ObjectAnimator animator = ObjectAnimator.ofFloat(forget, "rotation", 0, 360f);
    ObjectAnimator animator1 = ObjectAnimator.ofFloat(forget, "alpha", 1f, 0f, 1f);
    AnimatorSet set = new AnimatorSet();
    set.play(animator).with(animator1);
    set.setDuration(5000);
    set.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:MainActivity.java

示例8: show

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void show(int position) {
    int angle = position == 0 ? 45 : 135;
    float x = (float) Math.cos(angle * (Math.PI / 180)) * Util.dipTopx(this, 80);
    float y = (float) -Math.sin(angle * (Math.PI / 180)) * Util.dipTopx(this, 80);
    ObjectAnimator objectAnimatorX = ObjectAnimator.ofFloat(mLays[position], "translationX", 0, x);
    ObjectAnimator objectAnimatorY = ObjectAnimator.ofFloat(mLays[position], "translationY", 0, y);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(180);
    animatorSet.play(objectAnimatorX).with(objectAnimatorY);
    animatorSet.start();
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:12,代码来源:PubActivity.java

示例9: startFirstAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void startFirstAnimation(View view) {
    // 翻转动画
    ObjectAnimator rotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 0f, 25f);
    // 透明动画
    ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(mView1, "alpha", 1f, 0.5f);
    // 缩放动画
    ObjectAnimator scaleXAnimation = ObjectAnimator.ofFloat(mView1, "scaleX", 1f, 0.8f);
    ObjectAnimator scaleYAnimation = ObjectAnimator.ofFloat(mView1, "scaleY", 1f, 0.8f);
    // 位移动画
    ObjectAnimator translationYAnimation = ObjectAnimator.ofFloat(mView1, "translationY", 0f, -0.1f * mView1.getHeight());
    // 翻转动画
    ObjectAnimator rerotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 25f, 0f);
    rerotationXAnimation.setStartDelay(200);
    // 位移动画
    ObjectAnimator translationYAnimation2 = ObjectAnimator.ofFloat(mView2, "translationY", mView2.getHeight(), 0);
    translationYAnimation2.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            mView2.setVisibility(View.VISIBLE);
        }
    });

    AnimatorSet as = new AnimatorSet();
    as.playTogether(rotationXAnimation, alphaAnimation, scaleXAnimation, scaleYAnimation, translationYAnimation, rerotationXAnimation, translationYAnimation2);
    as.setDuration(200);
    as.start();
}
 
开发者ID:GitLqr,项目名称:MaterialDesignDemo,代码行数:29,代码来源:ObjectAnimationActivity2.java

示例10: hideHelpOverlay

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void hideHelpOverlay() {
    if (animationsInProgress) return;
    animationsInProgress = true;
    titleLayout.bringToFront();
    mainLayout.setVisibility(View.VISIBLE);

    Animator hideAnimation;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        hideAnimation = ViewAnimationUtils.createCircularReveal(helpLayout, titleBtnHelpCenterX, titleBtnHelpCenterY, screenDiagonalPx, 0);
    } else {
        hideAnimation = ObjectAnimator.ofFloat(helpLayout, "alpha", 1f, 0f);
    }

    hideAnimation.setInterpolator(new AccelerateInterpolator());
    hideAnimation.setDuration(250);

    hideAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            helpLayout.setVisibility(View.GONE);
            animationsInProgress = false;
            helpLayoutShown = false;
            helpLayoutScrollView.scrollTo(0, 0);
        }
    });
    hideAnimation.start();
}
 
开发者ID:Ramotion,项目名称:showroom-android,代码行数:28,代码来源:ShowroomActivity.java

示例11: maybePerformFinishedAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * Runs the finish animation if it is has not been run after last level change.
 */
public void maybePerformFinishedAnimation() {
    if (mAnimationProgress > ANIMATION_PROGRESS_STOPPED) {
        return;
    }
    if (mAnimator != null) {
        mAnimator.cancel();
    }
    setAnimationProgress(ANIMATION_PROGRESS_STARTED);
    mAnimator = ObjectAnimator.ofFloat(this, "animationProgress",
            ANIMATION_PROGRESS_STARTED, ANIMATION_PROGRESS_COMPLETED);
    mAnimator.start();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:16,代码来源:PreloadIconDrawable.java

示例12: animateHeartButton

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void animateHeartButton(final RecipesAdapter.RecipeViewHolder holder) {
    AnimatorSet animatorSet = new AnimatorSet();

    ObjectAnimator rotation = ObjectAnimator.ofFloat(holder.likeButton, "rotation", 0.0f, 360.0f);
    rotation.setDuration(800);
    rotation.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(holder.likeButton, "scaleX", 1.0f, 1.5f, 1.0f);
    scaleX.setDuration(800);
    scaleX.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(holder.likeButton, "scaleY", 1.0f, 1.5f, 1.0f);
    scaleY.setDuration(800);
    scaleY.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);

    rotation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            if (valueAnimator.getCurrentPlayTime() >= 500) {
                holder.likeButton.setImageResource(R.drawable.ic_favorite_higlighted_24dp);
            }
        }
    });

    animatorSet.playTogether(rotation, scaleX, scaleY);

    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animator) {
            dispatchAnimationFinished(holder);
        }

    });

    animatorSet.start();

}
 
开发者ID:vicky7230,项目名称:Paprika,代码行数:36,代码来源:RecipesItemAnimator.java

示例13: getAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Nullable
private Animator getAnimator(ViewGroup container, SceneInfo info, boolean isUpper) {
  if (info.viewState == SceneInfo.NONE) {
    return null;
  } else {
    boolean isFrom = info.viewState == SceneInfo.NEWLY_ATTACHED;
    int direction = isUpper ? this.direction : reverseDirection(this.direction);

    switch (direction) {
      case LEFT:
        if (isFrom) {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_X, -container.getWidth(), 0);
        } else {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_X, 0, -container.getWidth());
        }
      case TOP:
        if (isFrom) {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_Y, -container.getHeight(), 0);
        } else {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_Y, 0, -container.getHeight());
        }
      default:
      case RIGHT:
        if (isFrom) {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_X, container.getWidth(), 0);
        } else {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_X, 0, container.getWidth());
        }
      case BOTTOM:
        if (isFrom) {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_Y, container.getHeight(), 0);
        } else {
          return ObjectAnimator.ofFloat(info.view, View.TRANSLATION_Y, 0, container.getHeight());
        }
    }
  }
}
 
开发者ID:seven332,项目名称:Stage,代码行数:38,代码来源:ShiftCurtain.java

示例14: createAnimations

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private Animator[] createAnimations() {
    Animator[] animators = new Animator[size];
    for (int i = 0; i < spots.length; i++) {
        Animator move = ObjectAnimator.ofFloat(spots[i], "xFactor", 0, 1);
        move.setDuration(DURATION);
        move.setInterpolator(new HesitateInterpolator());
        move.setStartDelay(DELAY * i);
        animators[i] = move;
    }
    return animators;
}
 
开发者ID:weileng11,项目名称:KUtils-master,代码行数:12,代码来源:SpotsDialog.java

示例15: initAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void initAnimation() {
    lineAnimator = ObjectAnimator.ofFloat(StepperIndicator.this, "animProgress", 0.0f, 1.0f);
    lineAnimator.setDuration(500);
    lineAnimator.setInterpolator(new DecelerateInterpolator());
    lineAnimator.start();
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:7,代码来源:StepperIndicator.java


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