本文整理汇总了Java中android.view.animation.LinearInterpolator类的典型用法代码示例。如果您正苦于以下问题:Java LinearInterpolator类的具体用法?Java LinearInterpolator怎么用?Java LinearInterpolator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearInterpolator类属于android.view.animation包,在下文中一共展示了LinearInterpolator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setTheme(R.style.AppTheme);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_share_element);
mImageView = (ImageView) findViewById(R.id.image_view);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mImageView.setTransitionName(MainActivity.TRANSITION_NAME_SHARE);
} else {
ShareElementInfo info = getIntent().getExtras().getParcelable(MainActivity.EXTRA_SHARE_ELEMENT_INFO);
mShareElement = new FKJShareElement(info, this, mImageView.getRootView());
mShareElement.convert(mImageView)
.setDuration(ANIMATOR_DURATION)
.setInterpolator(new LinearInterpolator())
.startEnterAnimator();
}
}
示例2: startAnim
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
/**
* 开始旋转
*
* @param start
* @param end
* @param time
*/
private void startAnim(int start, final int end, long time) {
isAround = true;
mCurrentMode = MODE_ROTATE;
mValueAnimator = ValueAnimator.ofInt(start, end);
mValueAnimator.setDuration(time);
mValueAnimator.setRepeatCount(getRepeatCount());
mValueAnimator.setRepeatMode(ValueAnimator.RESTART);
mValueAnimator.setInterpolator(new LinearInterpolator());
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (currentValue != (int) (animation.getAnimatedValue())) {
onAnimatorUpdate(animation);
}
}
});
mValueAnimator.start();
}
示例3: loadAnimation
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
public void loadAnimation(boolean enabled) {
if (!enabled) {
currentScale = 1;
invalidate();
} else {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0.3f, 1.0f);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.setDuration(animDuration);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
currentScale = (float) animation.getAnimatedValue();
invalidate();
}
});
valueAnimator.start();
}
}
示例4: startIncertitudeAnimator
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
private void startIncertitudeAnimator() {
if (mColorAnimator == null) {
mColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), mProgressColor, SkinHelper.getTranColor(mProgressColor, 0x10));
mColorAnimator.setInterpolator(new LinearInterpolator());
mColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
drawColor = (int) animation.getAnimatedValue();//之后就可以得到动画的颜色了.
postInvalidate();
}
});
mColorAnimator.setDuration(1000);
mColorAnimator.setRepeatCount(ValueAnimator.INFINITE);
mColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
}
mColorAnimator.start();
}
示例5: init
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
private void init(Context context) {
mFlipAnimation = new RotateAnimation(0, -180,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mFlipAnimation.setInterpolator(new LinearInterpolator());
mFlipAnimation.setDuration(250);
mFlipAnimation.setFillAfter(true);
mReverseFlipAnimation = new RotateAnimation(-180, 0,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
mReverseFlipAnimation.setDuration(250);
mReverseFlipAnimation.setFillAfter(true);
mRefreshView = (LinearLayout) View.inflate(context, R.layout.pull_to_refresh_header, null);
mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
mRefreshViewImage = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image);
mRefreshViewProgress = (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress);
mRefreshViewLastUpdated = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
mRefreshState = PULL_TO_REFRESH;
mRefreshViewImage.setMinimumHeight(50); //设置下拉最小的高度为50
setFadingEdgeLength(0);
setHeaderDividersEnabled(false);
//把refreshview加入到listview的头部
addHeaderView(mRefreshView);
super.setOnScrollListener(this);
mRefreshView.setOnClickListener(this);
mRefreshView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
mRefreshViewHeight = mRefreshView.getMeasuredHeight();
mRefreshOriginalTopPadding = -mRefreshViewHeight;
resetHeaderPadding();
}
示例6: LineFadeIndicator
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
public LineFadeIndicator(DachshundTabLayout dachshundTabLayout) {
this.dachshundTabLayout = dachshundTabLayout;
valueAnimator = new ValueAnimator();
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.setDuration(DEFAULT_DURATION);
valueAnimator.addUpdateListener(this);
valueAnimator.setIntValues(0,255);
paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);
rectF = new RectF();
startXLeft = (int) dachshundTabLayout.getChildXLeft(dachshundTabLayout.getCurrentPosition());
startXRight = (int) dachshundTabLayout.getChildXRight(dachshundTabLayout.getCurrentPosition());
edgeRadius = -1;
}
示例7: toolbarAnimateHide
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
private void toolbarAnimateHide() {
if (mIsActionBarVisible) {
mCommonToolbar.animate()
.translationY(-mCommonToolbar.getHeight())
.setInterpolator(new LinearInterpolator())
.setDuration(180)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
toolbarSetElevation(0);
hideStatusBar();
if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
mTocListPopupWindow.dismiss();
}
}
});
mIsActionBarVisible = false;
}
}
示例8: AnimatingDrawable
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
private AnimatingDrawable(Drawable[] frames, long duration) {
mFrames = frames;
mAnimator = ValueAnimator.ofInt(0, mFrames.length - 1);
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
// Normalize the position in case the interporator isn't linear
int pos = Math.max(Math.min((int) animation.getAnimatedValue(), mFrames.length - 1), 0);
setFrame(mFrames[pos]);
}
});
mAnimator.setDuration(duration);
mAnimator.setInterpolator(new LinearInterpolator());
// Calculate the largest drawable, and use that as our intrinsic width/height
for (Drawable drawable : mFrames) {
mIntrinsicWidth = Math.max(mIntrinsicWidth, drawable.getIntrinsicWidth());
mIntrinsicHeight = Math.max(mIntrinsicHeight, drawable.getIntrinsicWidth());
}
setFrame(mFrames[0]);
}
示例9: onNestedScroll
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
@NonNull FloatingActionButton child,
@NonNull View target,
int dxConsumed,
int dyConsumed,
int dxUnconsumed,
int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
//child -> Floating Action Button
if (dyConsumed > 0) {
Log.d("Scrolling", "Up");
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
int fab_bottomMargin = layoutParams.bottomMargin;
child.animate().translationY(child.getHeight() + fab_bottomMargin).setInterpolator(new LinearInterpolator()).start();
} else if (dyConsumed < 0) {
Log.d("Scrolling", "down");
child.animate().translationY(0).setInterpolator(new LinearInterpolator()).start();
}
}
示例10: initAnimations
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
private void initAnimations() {
searchAnimation = ValueAnimator.ofFloat(0f, 1f);
searchAnimation.setDuration(50000);
searchAnimation.setRepeatCount(ValueAnimator.INFINITE);
searchAnimation.setRepeatMode(ValueAnimator.RESTART);
searchAnimation.setInterpolator(new LinearInterpolator());
searchAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float angle = (valueAnimator.getAnimatedFraction() * 360);
ViewHelper.setTranslationX(ivSearch, (float) Math.sin(angle) * radius);
ViewHelper.setTranslationY(ivSearch, (float) Math.cos(angle) * radius);
}
});
scanAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.61f);
scanAnimation.setDuration(2000);
scanAnimation.setRepeatCount(TranslateAnimation.INFINITE);
scanAnimation.setRepeatMode(TranslateAnimation.RESTART);
}
示例11: MoveXBy
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
public void MoveXBy(float distance,long duration,final boolean StopRotationAtCurrentAngle)
{
final FriskyTanslations friskyTanslations1 =this;
Runnable runnable=new Runnable() {
@Override
public void run() {
if(StopRotationAtCurrentAngle)
{
friskyTanslations1.StopCrazyRotationAtCurrentAngle();
}
else
{
friskyTanslations1.StopCrazyRotationAtAngle(0);
}
}
};
view.animate().translationXBy(distance).setInterpolator(new LinearInterpolator()).withEndAction(runnable).setDuration(duration).start();
}
示例12: rotate
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
public static void rotate(View v){
//创建旋转动画 对象 fromDegrees:旋转开始的角度 toDegrees:结束的角度
RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
//设置动画的显示时间
rotateAnimation.setDuration(1000);
//设置动画重复播放几次
rotateAnimation.setRepeatCount(RotateAnimation.INFINITE);
//设置动画插值器
rotateAnimation.setInterpolator(new LinearInterpolator());
//设置动画重复播放的方式,翻转播放
rotateAnimation.setRepeatMode(Animation.RESTART);
//拿着imageview对象来运行动画效果
v.setAnimation(rotateAnimation);
}
示例13: CustomOscillation
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
public void CustomOscillation(int startAngle, final int MaxAngleOfRotation,final int TimeToReachStartAngle,final int TimePeriodOfOscillation)
{
runnable1 = new Runnable() {
@Override
public void run() {
imageView.animate().rotationBy((-1)*MaxAngleOfRotation).withEndAction(runnable2).setDuration(TimePeriodOfOscillation).setInterpolator(new LinearInterpolator()).start();
}
};
runnable2 = new Runnable() {
@Override
public void run() {
imageView.animate().rotationBy(MaxAngleOfRotation).withEndAction(runnable1).setDuration(TimePeriodOfOscillation).setInterpolator(new LinearInterpolator()).start();
}
};
imageView.animate().rotationBy(startAngle).withEndAction(runnable1).setDuration(TimeToReachStartAngle).setInterpolator(new LinearInterpolator()).start();
}
示例14: StopCrazyRotationAtCurrentAngle
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
public void StopCrazyRotationAtCurrentAngle()
{
runnable1 = new Runnable() {
@Override
public void run() {
imageView.animate().rotationBy(0).withEndAction(runnable2).setDuration(0).setInterpolator(new LinearInterpolator()).start();
}
};
runnable2 = new Runnable() {
@Override
public void run() {
imageView.animate().rotationBy(0).withEndAction(runnable1).setDuration(0).setInterpolator(new LinearInterpolator()).start();
}
};
imageView.animate().rotationBy(0).withEndAction(runnable1).setDuration(0).setInterpolator(new LinearInterpolator()).start();
}
示例15: init
import android.view.animation.LinearInterpolator; //导入依赖的package包/类
private void init(){
mView = getView();
mText = (TextView)mView.findViewById(R.id.txt);
img = (ImageView)mView.findViewById(R.id.img);
Animation operatingAnim = AnimationUtils.loadAnimation(getContext(), R.anim.loading_anim);
LinearInterpolator lin = new LinearInterpolator();
operatingAnim.setInterpolator(lin);
img.setAnimation(operatingAnim);
img.startAnimation(operatingAnim);
}