當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。