Java 类android.view.animation.Animation 实例源码
项目:ExpandButton
文件:ExpandButtonLayout.java
public void open() {
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(duration);
animationSet.setAnimationListener(this);
animationSet.setFillAfter(true);
RotateAnimation rotateAnimation = new RotateAnimation(270, 360,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(rotateAnimation);
Animation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f,
ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(scaleAnimation);
imageView.startAnimation(animationSet);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", 0, mLinearLayoutWidth);
ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", 0, savePaddingLeft);
ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", 0, savePaddingRight);
ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", 0, saveMarginLeft);
ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", 0, saveMarginRight);
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
animatorSet.setDuration(duration).start();
}
项目:Hamburger-Button
文件:HBButton.java
private Animation generateLineRTLAnimation(final RectF rectF, long offset) {
final float currentLeft = rectF.left;
final float currentRight = rectF.right;
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (getCurrentState() == HBButtonState.NORMAL) {
rectF.set(currentLeft + (currentRight - currentLeft) / 2 * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
} else {
rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
}
invalidate();
}
};
animation.setDuration(getAnimationDuration());
animation.setStartOffset(offset);
return animation;
}
项目:RLibrary
文件:UILayoutImpl.java
/**
* 销毁对话框的动画
*/
private void finishDialogAnim(final ViewPattern dialogPattern, final Animation animation, final Runnable end) {
/*是否变暗*/
if (dialogPattern.mIView.isDimBehind()) {
AnimUtil.startArgb(dialogPattern.mIView.getDialogDimView(),
dialogPattern.mIView.getDimColor(), Color.TRANSPARENT, DEFAULT_ANIM_TIME);
}
final View animView = dialogPattern.mIView.getAnimView();
final Runnable endRunnable = new Runnable() {
@Override
public void run() {
dialogPattern.mView.setAlpha(0);
dialogPattern.mView.setVisibility(INVISIBLE);
end.run();
}
};
safeStartAnim(animView, animation, endRunnable, true);
}
项目:AppLocker
文件:LockActivity.java
protected void onPasscodeError() {
Encryptor.snackPeak(mActivity,getString(R.string.passcode_wrong));
Thread thread = new Thread() {
public void run() {
Animation animation = AnimationUtils.loadAnimation(
LockActivity.this, R.anim.shake);
findViewById(R.id.ll_applock).startAnimation(animation);
codeField1.setText("");
codeField2.setText("");
codeField3.setText("");
codeField4.setText("");
codeField1.requestFocus();
}
};
runOnUiThread(thread);
}
项目:boohee_v5.6
文件:ExpandableLayout.java
private void expand(final View v) {
v.measure(-1, -2);
final int targetHeight = v.getMeasuredHeight();
v.getLayoutParams().height = 0;
v.setVisibility(0);
this.animation = new Animation() {
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime == 1.0f) {
ExpandableLayout.this.isOpened = Boolean.valueOf(true);
}
v.getLayoutParams().height = interpolatedTime == 1.0f ? -2 : (int) (((float)
targetHeight) * interpolatedTime);
v.requestLayout();
}
public boolean willChangeBounds() {
return true;
}
};
this.animation.setDuration((long) this.duration.intValue());
v.startAnimation(this.animation);
}
项目:AndroidBackendlessChat
文件:ChatSDKMessagesListAdapter.java
/**
* Animating the sides of the row, For example animating the user profile image and the message date.
* */
private void animateSides(View view, boolean fromLeft, Animation.AnimationListener animationListener){
if (!isScrolling)
return;
if (fromLeft)
view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_left));
else view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_right));
view.getAnimation().setAnimationListener(animationListener);
view.animate();
}
项目:boohee_v5.6
文件:FloatingActionButtonEclairMr1.java
void show(@Nullable final InternalVisibilityChangedListener listener, boolean fromUser) {
if (this.mView.getVisibility() != 0 || this.mIsHiding) {
this.mView.clearAnimation();
this.mView.internalSetVisibility(0, fromUser);
Animation anim = AnimationUtils.loadAnimation(this.mView.getContext(), R.anim.design_fab_in);
anim.setDuration(200);
anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR);
anim.setAnimationListener(new AnimationListenerAdapter() {
public void onAnimationEnd(Animation animation) {
if (listener != null) {
listener.onShown();
}
}
});
this.mView.startAnimation(anim);
} else if (listener != null) {
listener.onShown();
}
}
项目:BrotherWeather
文件:CustomRefreshLayout2.java
private void startLoadingAnimation(ImageView imageView) {
RotateAnimation loadingAnimation =
new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
loadingAnimation.setDuration(1000);
loadingAnimation.setRepeatCount(-1);
loadingAnimation.setInterpolator(new LinearInterpolator());
imageView.setAnimation(loadingAnimation);
loadingAnimation.start();
}
项目:GeekZone
文件:SwipeRefreshLayout.java
private void startScaleUpAnimation(AnimationListener listener) {
mCircleView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
// Pre API 11, alpha is used in place of scale up to show the
// progress circle appearing.
// Don't adjust the alpha during appearance otherwise.
mProgress.setAlpha(MAX_ALPHA);
}
mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(mMediumAnimationDuration);
if (listener != null) {
mCircleView.setAnimationListener(listener);
}
mCircleView.clearAnimation();
mCircleView.startAnimation(mScaleAnimation);
}
项目:ywApplication
文件:RotateLoadingLayout.java
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
super(context, mode, scrollDirection, attrs);
mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);
mHeaderImage.setScaleType(ScaleType.MATRIX);
mHeaderImageMatrix = new Matrix();
mHeaderImage.setImageMatrix(mHeaderImageMatrix);
mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
mRotateAnimation.setRepeatCount(Animation.INFINITE);
mRotateAnimation.setRepeatMode(Animation.RESTART);
}
项目:Aurora
文件:ExpandTextView.java
public void expand() {
if (!isExpand) {
isExpand = true;
mText.setTextColor(Color.TRANSPARENT);
mExpandText.setTextColor(mTextColor);
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
ViewGroup.LayoutParams params = ExpandTextView.this.getLayoutParams();
params.height = mStart + (int) ((mEnd - mStart) * interpolatedTime);
setLayoutParams(params);
}
};
animation.setDuration(500);
startAnimation(animation);
}
}
项目:iReading
文件:RefreshViewHeader.java
private void initView(Context context) {
mContent = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.rfv_header, this);
imgDirectionArrow = (ImageView) findViewById(R.id.imgDirectionArrow);
tvRefreshState = (TextView) findViewById(R.id.tvRefreshState);
tvLastRefreshTime = (TextView) findViewById(R.id.tvLastRefreshTime);
mProgressBar = (ProgressBar) findViewById(R.id.rfv_header_progressbar);
mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateUpAnim.setFillAfter(true);
mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateDownAnim.setFillAfter(true);
}
项目:Pocket-Plays-for-Twitch
文件:WelcomeActivity.java
private AnimationSet startShowContinueIconAnimations() {
Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
Animation mRotateAnimation = new RotateAnimation(
0, 360,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f
);
mRotateAnimation.setRepeatCount(0);
AnimationSet mAnimations = new AnimationSet(true);
mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
mAnimations.setFillAfter(true);
mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
mAnimations.addAnimation(mScaleAnimation);
mAnimations.addAnimation(mRotateAnimation);
mContinueIcon.startAnimation(mAnimations);
return mAnimations;
}
项目:PlusGram
文件:View10.java
public static View10 wrap(View view) {
View10 proxy = PROXIES.get(view);
Animation animation = view.getAnimation();
if (proxy == null || proxy != animation && animation != null) {
proxy = new View10(view);
PROXIES.put(view, proxy);
} else if (animation == null) {
view.setAnimation(proxy);
}
return proxy;
}
项目:betterHotels
文件:Utils.java
public static void animationIn(final View view, final int animation, int delayTime, final Context context) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Animation inAnimation = AnimationUtils.loadAnimation(
context.getApplicationContext(), animation);
view.setAnimation(inAnimation);
view.setVisibility(View.VISIBLE);
}
}, delayTime);
}
项目:AndroidOpen
文件:SwipeToRefreshLayout.java
private void startScaleUpAnimation(Animation.AnimationListener listener) {
mLoadingView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
mProgress.setAlpha(255);
}
Animation mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
if (listener != null) {
mLoadingView.setAnimationListener(listener);
}
mLoadingView.clearAnimation();
mLoadingView.startAnimation(mScaleAnimation);
}
项目:secretknock
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
editor = sharedPreferences.edit();
an = new RotateAnimation(0.0f,
360.0f,Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF,
0.5f);
// Set the animation's parameters
an.setInterpolator(new LinearInterpolator());
an.setDuration(7000); // duration in ms
an.setRepeatCount(-1); // -1 = infinite repeated
}
项目:QMUI_Android
文件:QMUIBottomSheet.java
/**
* BottomSheet升起动画
*/
private void animateUp() {
if (mContentView == null) {
return;
}
TranslateAnimation translate = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
AnimationSet set = new AnimationSet(true);
set.addAnimation(translate);
set.addAnimation(alpha);
set.setInterpolator(new DecelerateInterpolator());
set.setDuration(mAnimationDuration);
set.setFillAfter(true);
mContentView.startAnimation(set);
}
项目:qmui
文件:QMUIBottomSheet.java
/**
* BottomSheet升起动画
*/
private void animateUp() {
if (mContentView == null) {
return;
}
TranslateAnimation translate = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
AnimationSet set = new AnimationSet(true);
set.addAnimation(translate);
set.addAnimation(alpha);
set.setInterpolator(new DecelerateInterpolator());
set.setDuration(mAnimationDuration);
set.setFillAfter(true);
mContentView.startAnimation(set);
}
项目:android-source-codes
文件:SwipeRefreshLayout.java
@Override
public void onAnimationEnd(Animation animation) {
if (mRefreshing) {
// Make sure the progress view is fully visible
mProgress.setAlpha(MAX_ALPHA);
mProgress.start();
if (mNotify) {
if (mListener != null) {
mListener.onRefresh();
}
}
mCurrentTargetOffsetTop = mCircleView.getTop();
} else {
reset();
}
}
项目:XinFramework
文件:TransactionDelegate.java
private void mockStartWithPopAnim(ISupportFragment from, ISupportFragment to, final Animation exitAnim) {
Fragment fromF = (Fragment) from;
final ViewGroup container = findContainerById(fromF, from.getSupportDelegate().mContainerId);
if (container == null) return;
from.getSupportDelegate().mLockAnim = true;
View fromView = fromF.getView();
container.removeViewInLayout(fromView);
final ViewGroup mock = addMockView(fromView, container);
to.getSupportDelegate().mEnterAnimListener = new SupportFragmentDelegate.EnterAnimListener() {
@Override
public void onEnterAnimStart() {
mock.startAnimation(exitAnim);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
container.removeView(mock);
}
}, exitAnim.getDuration() + BUFFER_TIME);
}
};
}
项目:LuaViewPlayground
文件:SuperSwipeRefreshLayout.java
private void startScaleUpAnimation(AnimationListener listener) {
mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime,
Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(mMediumAnimationDuration);
if (listener != null) {
mHeadViewContainer.setAnimationListener(listener);
}
mHeadViewContainer.clearAnimation();
mHeadViewContainer.startAnimation(mScaleAnimation);
}
项目:SunmiUI
文件:CodeDialog.java
public void showLoad() {
isReq = true;
load.setVisibility(View.VISIBLE);
clear.setVisibility(View.GONE);
Animation operatingAnim = AnimationUtils.loadAnimation(dialog.getContext(), R.anim.loading_anim);
LinearInterpolator lin = new LinearInterpolator();
operatingAnim.setInterpolator(lin);
load.setAnimation(operatingAnim);
load.startAnimation(operatingAnim);
}
项目:QMark
文件:WelcomeSnowActy.java
private ScaleAnimation randomScale() {
float scaleTo = (float) (0.3f + Math.random() * 0.5f);
ScaleAnimation scale = new ScaleAnimation(1, scaleTo, 1, scaleTo, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scale.setRepeatCount(Animation.INFINITE);
scale.setRepeatMode(Animation.REVERSE);
scale.setStartOffset(1000);
scale.setDuration((int) (Math.random() * 3000) + 1000);
return scale;
}
项目:FLFloatingButton
文件:RayLayout.java
private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
animation.setStartOffset(startOffset);
animation.setDuration(duration);
animation.setInterpolator(interpolator);
animation.setFillAfter(true);
return animation;
}
项目:ForeverLibrary
文件:ActionSheet.java
private Animation createTranslationOutAnimation() {
int type = TranslateAnimation.RELATIVE_TO_SELF;
TranslateAnimation an = new TranslateAnimation(type, 0, type, 0, type, 0, type, 1);
an.setDuration(TRANSLATE_DURATION);
an.setFillAfter(true);
return an;
}
项目:RLibrary
文件:AnimUtil.java
/**
* 应用一个布局动画
*/
public static void applyLayoutAnimation(final ViewGroup viewGroup) {
TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1f,
Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, 0f, Animation.RELATIVE_TO_PARENT, 0f);
translateAnimation.setDuration(300);
applyLayoutAnimation(viewGroup, translateAnimation);
}
项目:android-mvvm-architecture
文件:ViewAnimationUtils.java
public static void scaleAnimateView(View view) {
ScaleAnimation animation =
new ScaleAnimation(
1.15f, 1, 1.15f, 1,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
view.setAnimation(animation);
animation.setDuration(100);
animation.start();
}
项目:iBeaconReader
文件:MainActivity.java
public void Evt(long number) {
Animation Animation = AnimationUtils.loadAnimation(this, R.anim.shake);
imageView.startAnimation(Animation);
Intent goToApp = new Intent(MainActivity.this, BeaconActivity.class);
// Create the AlertDialog for failed authentication
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage(R.string.fail)
.setNegativeButton(R.string.retry, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
Dialog auth_error = builder.create();
// Check if Izly card is authorized and passing tech id as parameter
boolean go = true;
if (number == -1971634176) {
goToApp.putExtra("tech", 1);
} else if (number == -2106576896) {
goToApp.putExtra("tech", 2);
} else {
go = false;
}
// Launch iBeacon activity or show error dialog
if(go){
startActivity(goToApp);
} else {
auth_error.show();
}
}
项目:gesture-refresh-layout
文件:GestureRefreshLayout.java
private void startScaleDownAnimation(Animation.AnimationListener listener) {
mScaleDownAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(1 - interpolatedTime);
}
};
mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION);
mScaleDownAnimation.setAnimationListener(listener);
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mScaleDownAnimation);
}
项目:FireFiles
文件:MaterialProgressDrawable.java
@Override
public boolean isRunning() {
final ArrayList<Animation> animators = mAnimators;
final int N = animators.size();
for (int i = 0; i < N; i++) {
final Animation animator = animators.get(i);
if (animator.hasStarted() && !animator.hasEnded()) {
return true;
}
}
return false;
}
项目:rongyunDemo
文件:ClearWriteEditText.java
/**
* 晃动动画
* @param counts 半秒钟晃动多少下
* @return
*/
public static Animation shakeAnimation(int counts) {
Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
translateAnimation.setInterpolator(new CycleInterpolator(counts));
translateAnimation.setDuration(500);
return translateAnimation;
}
项目:OSchina_resources_android
文件:KJAnimations.java
/**
* 旋转 Rotate
*/
public static Animation getRotateAnimation(float fromDegrees,
float toDegrees, long durationMillis) {
RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
rotate.setDuration(durationMillis);
rotate.setFillAfter(true);
return rotate;
}
项目:CustomListView
文件:IndicatorLayout.java
@Override
public void onAnimationEnd(Animation animation) {
if (animation == mOutAnim) {
mArrowImageView.clearAnimation();
setVisibility(View.GONE);
} else if (animation == mInAnim) {
setVisibility(View.VISIBLE);
}
clearAnimation();
}
项目:AnimatedPullToRefresh-master
文件:AnimationHelper.java
private void addTextRotateAnimations(AnimationSet set) {
RotateAnimation mRotateUpAnim = new RotateAnimation(0.0f, ROTATION_ANGLE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateUpAnim.setDuration(CHARACTER_ANIM_DURATION);
set.addAnimation(mRotateUpAnim);
RotateAnimation mRotateDownAnim = new RotateAnimation(ROTATION_ANGLE, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateDownAnim.setDuration(CHARACTER_ANIM_DURATION);
mRotateDownAnim.setStartOffset(CHARACTER_ANIM_DURATION + 20);
mRotateDownAnim.setFillAfter(true);
set.addAnimation(mRotateDownAnim);
set.setInterpolator(interpolator);
}
项目:android-mvp-interactor-architecture
文件:MainActivity.java
@Override
public void reloadQuestionnaire(List<Question> questionList) {
refreshQuestionnaire(questionList);
ScaleAnimation animation =
new ScaleAnimation(
1.15f, 1, 1.15f, 1,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
mCardsContainerView.setAnimation(animation);
animation.setDuration(100);
animation.start();
}
项目:Programmers
文件:AnimUtils.java
public static Animation blink() {
Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(550);
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(10);
animation.setRepeatMode(Animation.REVERSE);
return animation;
}
项目:QMark
文件:WelcomeSnowActy.java
private RotateAnimation randomRotate(int duration) {
RotateAnimation rotate = new RotateAnimation(0, (float) ((Math.random() > 0.5f ? 1 : -1) * 360 / (Math.random() * 20000 + 1000) * duration),
Animation.RELATIVE_TO_SELF, (float) (Math.random() * 0.5f), Animation.RELATIVE_TO_SELF, (float) (Math.random() * 0.5f));
rotate.setRepeatCount(Animation.INFINITE);
rotate.setRepeatMode(Animation.RESTART);
rotate.setStartOffset(0);
rotate.setDuration(duration);
return rotate;
}
项目:RLibrary
文件:AnimUtil.java
/**
* 启动时的动画 从底部平移到顶部
*/
public static Animation translateAlphaStartAnimation() {
TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
setDefaultConfig(translateAnimation, false);
setDefaultConfig(alphaAnimation, false);
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
项目:Cable-Android
文件:InputPanel.java
public void moveTo(float x) {
float offset = getOffset(x);
Animation animation = new TranslateAnimation(Animation.ABSOLUTE, offset,
Animation.ABSOLUTE, offset,
Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 0);
animation.setDuration(0);
animation.setFillAfter(true);
animation.setFillBefore(true);
slideToCancelView.startAnimation(animation);
}