本文整理汇总了Java中android.support.v4.view.animation.PathInterpolatorCompat类的典型用法代码示例。如果您正苦于以下问题:Java PathInterpolatorCompat类的具体用法?Java PathInterpolatorCompat怎么用?Java PathInterpolatorCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PathInterpolatorCompat类属于android.support.v4.view.animation包,在下文中一共展示了PathInterpolatorCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: animateStaticImageVisibility
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
private void animateStaticImageVisibility(boolean visible) {
// If the panel is expanded then #onUpdateFromPeekToExpand() is responsible for setting
// mStaticImageVisibility and the static image appearance should not be animated.
if (visible && mExpandedPercentage > 0.f) return;
if (mStaticImageVisibilityInterpolator == null) {
mStaticImageVisibilityInterpolator =
PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f);
}
mOverlayPanelAnimation.cancelAnimation(this, AnimationType.STATIC_IMAGE_VISIBILITY);
float endValue = visible ? 1.f : 0.f;
mOverlayPanelAnimation.addToAnimation(this, AnimationType.STATIC_IMAGE_VISIBILITY,
mStaticImageVisibilityPercentage, endValue,
OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false,
mStaticImageVisibilityInterpolator);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:ContextualSearchImageControl.java
示例2: animateCustomImageVisibility
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
private void animateCustomImageVisibility(boolean visible) {
// If the panel is expanded then #onUpdateFromPeekToExpand() is responsible for setting
// mCustomImageVisibility and the custom image appearance should not be animated.
if (visible && mExpandedPercentage > 0.f) return;
if (mCustomImageVisibilityInterpolator == null) {
mCustomImageVisibilityInterpolator =
PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f);
}
mOverlayPanelAnimation.cancelAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY);
float endValue = visible ? 1.f : 0.f;
mOverlayPanelAnimation.addToAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY,
mCustomImageVisibilityPercentage, endValue,
OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false,
mCustomImageVisibilityInterpolator);
}
示例3: createTimeInterpolator
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
private static @Nullable
Interpolator createTimeInterpolator(@NonNull WXAnimationBean animation) {
String interpolator = animation.timingFunction;
if (!TextUtils.isEmpty(interpolator)) {
switch (interpolator) {
case WXAnimationBean.EASE_IN:
return new AccelerateInterpolator();
case WXAnimationBean.EASE_OUT:
return new DecelerateInterpolator();
case WXAnimationBean.EASE_IN_OUT:
return new AccelerateDecelerateInterpolator();
case WXAnimationBean.LINEAR:
return new LinearInterpolator();
default:
//Parse cubic-bezier
try {
SingleFunctionParser<Float> parser = new SingleFunctionParser<>(
animation.timingFunction,
new SingleFunctionParser.FlatMapper<Float>() {
@Override
public Float map(String raw) {
return Float.parseFloat(raw);
}
});
List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER);
if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) {
return PathInterpolatorCompat.create(
params.get(0), params.get(1), params.get(2), params.get(3));
}
else {
return null;
}
}catch (RuntimeException e){
return null;
}
}
}
return null;
}
示例4: createTimeInterpolator
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
private
@Nullable
Interpolator createTimeInterpolator() {
String interpolator = mAnimationBean.timingFunction;
if (!TextUtils.isEmpty(interpolator)) {
switch (interpolator) {
case WXAnimationBean.EASE_IN:
return new AccelerateInterpolator();
case WXAnimationBean.EASE_OUT:
return new DecelerateInterpolator();
case WXAnimationBean.EASE_IN_OUT:
return new AccelerateDecelerateInterpolator();
case WXAnimationBean.LINEAR:
return new LinearInterpolator();
default:
//Parse cubic-bezier
try {
SingleFunctionParser<Float> parser = new SingleFunctionParser<>(
mAnimationBean.timingFunction,
new SingleFunctionParser.FlatMapper<Float>() {
@Override
public Float map(String raw) {
return Float.parseFloat(raw);
}
});
List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER);
if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) {
return PathInterpolatorCompat.create(
params.get(0), params.get(1), params.get(2), params.get(3));
} else {
return null;
}
} catch (RuntimeException e) {
return null;
}
}
}
return null;
}
示例5: initAnimatior
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
private ValueAnimator initAnimatior(final ProgressBean pb) {
Interpolator pathInterpolatorCompat = PathInterpolatorCompat.create(0.7f, 0f, 0.3f, 1f);
ValueAnimator mAnimator = ValueAnimator.ofInt(0, 359);
mAnimator.setDuration(pb.getDuration());
mAnimator.setInterpolator(pathInterpolatorCompat);
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
Log.d("dur", animation.getAnimatedValue() + "====" + pb.getmBallRadius());
pb.setmCurrentAngle((int) animation.getAnimatedValue());
invalidate();
}
});
return mAnimator;
}
示例6: initAnimatior
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
private void initAnimatior() {
pathInterpolatorCompat = PathInterpolatorCompat.create(0.7f, 0f, 0.3f, 1f);
mAnimator = ValueAnimator.ofInt(0, 359);
mAnimator.setDuration(mDuration);
mAnimator.setRepeatCount(-1);
mAnimator.setInterpolator(pathInterpolatorCompat);
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mCurrentAngle = (int) animation.getAnimatedValue();
invalidate();
}
});
}
示例7: onScroll
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
@Override
public void onScroll(int height, int scrollArea, float scrollPosition) {
final Interpolator interpolator = PathInterpolatorCompat.create(.19f,0f,.2f,1f);
final float interpolation = interpolator.getInterpolation((scrollPosition * .30f));
final int bottomPadding = (int) (-1f * interpolation * scrollArea);
findViewById(R.id.activity_input).setTranslationY(bottomPadding);
findViewById(R.id.activity_recyclerview).setTranslationY(bottomPadding);
}
示例8: hidePlaceFlag
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
/**
* Hide the fab and blocking the ability to place a flag.
*/
private void hidePlaceFlag() {
mPlaceFlagButton
.animate()
.translationY(mPlaceFlagButton.getHeight() + mPlaceFlagButtonMarginBottom)
.setDuration(150)
.setInterpolator(PathInterpolatorCompat.create(0.4f, 0.0f, 0.6f, 1f))
.start();
mCannotCaptureTextView.setVisibility(View.INVISIBLE);
mFlagButtonIsShown = false;
}
示例9: onUserTouchMove
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
@Override
public void onUserTouchMove(MotionEvent motionEvent) {
float distance = Math.max(
Math.abs(motionEvent.getRawX() - originalX),
Math.abs(motionEvent.getRawY() - originalY)
);
unlockOnUp = distance > unlockDistance;
if (unlockOnUp && !hasVibrated) {
SRJHelper.vibrate(20, mContext);
hasVibrated = true;
}
float scale = distance/(mContext.getResources().getDimensionPixelSize(R.dimen.lockscreen_ac_display_unlock_distance_max));
final float MAX_ALPHA = 0.6f;
dimView.animate().alpha(scale/ MAX_ALPHA).setDuration(0).start();
Interpolator customInterpolator = PathInterpolatorCompat.create(0.080f, 1.80f, 0.590f, 1.70f);
scale = customInterpolator.getInterpolation(scale);
scaleAnimator = unlockView.animate().scaleX(scale).scaleY(scale).setDuration(0);
scaleAnimator.start();
float imgLockScale = scale/2;
if (imgLockScale > 0.35f) {
imgLockScale = 0.35f;
}
imgLock.animate().alpha(scale).scaleX(imgLockScale).scaleY(imgLockScale).setDuration(0).start();
}
示例10: initTangentInterpolator
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
private void initTangentInterpolator() {
if (mCircleRadius > 0 && (mDragHeight >= mCircleRadius * 2)) {
// The run // 270~360~mTangentAngle=>0~90~mTangentAngle
// When drag double radius the angle = MIN_RUN_ANGLE
mTangentInterpolator = PathInterpolatorCompat.create((mCircleRadius * 2) / mDragHeight,
MIN_RUN_ANGLE / (MIN_RUN_ANGLE + mTangentAngle));
}
}
示例11: doScroll
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
public void doScroll(String direction) {
Interpolator customInterpolator = PathInterpolatorCompat.create(0.445f, 0.050f, 0.550f, 0.950f);
if (direction.equals("up")) {
mRecyclerView.smoothScrollBy(0,(int) (-FullscreenActivity.scrollDistance * mRecyclerView.getHeight()),customInterpolator);
} else {
mRecyclerView.smoothScrollBy(0,(int) (+FullscreenActivity.scrollDistance * mRecyclerView.getHeight()),customInterpolator);
}
}
示例12: onStartRefreshAnimation
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
@Override
protected void onStartRefreshAnimation() {
if(mFlyAnimator != null){
mFlyAnimator.end();
}
final View iconView = getActionView();
UIUtils.clearAnimator(iconView);
AnimatorSet flyUpAnim = new AnimatorSet();
flyUpAnim.setDuration(800);
ObjectAnimator transX = ObjectAnimator.ofFloat(iconView, "translationX", 0, getWidth());
ObjectAnimator transY = ObjectAnimator.ofFloat(iconView, "translationY", 0, -mHeaderController.getHeight());
transY.setInterpolator(PathInterpolatorCompat.create(0.7f, 1f));
ObjectAnimator rotation = ObjectAnimator.ofFloat(iconView, "rotation", -45, 0);
rotation.setInterpolator(new DecelerateInterpolator());
ObjectAnimator rotationX = ObjectAnimator.ofFloat(iconView, "rotationX", 0, 60);
rotationX.setInterpolator(new DecelerateInterpolator());
flyUpAnim.playTogether(transX, transY, rotationX,
ObjectAnimator.ofFloat(iconView, "scaleX", 1, 0.5f),
ObjectAnimator.ofFloat(iconView, "scaleY", 1, 0.5f),
rotation
);
mFlyAnimator = flyUpAnim;
mFlyAnimator.start();
if (mListener != null) {
mListener.onRefresh(FlyRefreshLayout.this);
}
}
示例13: startRefresh
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
@Override
public void startRefresh() {
if (mFlyAnimator != null) {
mFlyAnimator.end();
}
final View iconView = getIconView();
UIUtils.clearAnimator(iconView);
AnimatorSet flyUpAnim = new AnimatorSet();
flyUpAnim.setDuration(800);
ObjectAnimator transX = ObjectAnimator.ofFloat(iconView, "translationX", 0, getWidth());
ObjectAnimator transY = ObjectAnimator.ofFloat(iconView, "translationY", 0, -mHeaderController.getHeight());
transY.setInterpolator(PathInterpolatorCompat.create(0.7f, 1f));
ObjectAnimator rotation = ObjectAnimator.ofFloat(iconView, "rotation", -45, 0);
rotation.setInterpolator(new DecelerateInterpolator());
ObjectAnimator rotationX = ObjectAnimator.ofFloat(iconView, "rotationX", 0, 60);
rotationX.setInterpolator(new DecelerateInterpolator());
flyUpAnim.playTogether(transX, transY, rotationX,
ObjectAnimator.ofFloat(iconView, "scaleX", 1, 0.5f),
ObjectAnimator.ofFloat(iconView, "scaleY", 1, 0.5f),
rotation
);
mFlyAnimator = flyUpAnim;
mFlyAnimator.start();
if (mListener != null) {
mListener.onRefresh(FlyRefreshLayout.this);
}
}
示例14: createInterpolator
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
/**
* 构造PathInterpolator
* @param segmentLength
* @return
*/
public Interpolator createInterpolator(float[] segmentLength){
Path p = createPath(segmentLength);
Interpolator inter = PathInterpolatorCompat.create(p);
return inter;
}
示例15: newInstance
import android.support.v4.view.animation.PathInterpolatorCompat; //导入依赖的package包/类
static <T> Keyframe<T> newInstance(JSONObject json, LottieComposition composition, float scale,
AnimatableValue.Factory<T> valueFactory) {
PointF cp1 = null;
PointF cp2 = null;
float startFrame = 0;
T startValue = null;
T endValue = null;
Interpolator interpolator = null;
if (json.has("t")) {
startFrame = (float) json.optDouble("t", 0);
Object startValueJson = json.opt("s");
if (startValueJson != null) {
startValue = valueFactory.valueFromObject(startValueJson, scale);
}
Object endValueJson = json.opt("e");
if (endValueJson != null) {
endValue = valueFactory.valueFromObject(endValueJson, scale);
}
JSONObject cp1Json = json.optJSONObject("o");
JSONObject cp2Json = json.optJSONObject("i");
if (cp1Json != null && cp2Json != null) {
cp1 = JsonUtils.pointFromJsonObject(cp1Json, scale);
cp2 = JsonUtils.pointFromJsonObject(cp2Json, scale);
}
boolean hold = json.optInt("h", 0) == 1;
if (hold) {
endValue = startValue;
// TODO: create a HoldInterpolator so progress changes don't invalidate.
interpolator = LINEAR_INTERPOLATOR;
} else if (cp1 != null) {
interpolator = PathInterpolatorCompat.create(
cp1.x / scale, cp1.y / scale, cp2.x / scale, cp2.y / scale);
} else {
interpolator = LINEAR_INTERPOLATOR;
}
} else {
startValue = valueFactory.valueFromObject(json, scale);
endValue = startValue;
}
return new Keyframe<>(composition, startValue, endValue, interpolator, startFrame, null);
}