本文整理汇总了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++;
}
示例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();
}
示例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;
}
示例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();
}
示例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);
}
}
}
}
示例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);
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
}
}
}
示例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;
}
示例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();
}