当前位置: 首页>>代码示例>>Java>>正文


Java PathInterpolatorCompat类代码示例

本文整理汇总了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);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:ContextualSearchImageControl.java

示例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;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:40,代码来源:WXAnimationModule.java

示例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;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:40,代码来源:AnimationAction.java

示例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;
}
 
开发者ID:yanyiqun001,项目名称:goRefresh,代码行数:16,代码来源:MulRingProgressBar.java

示例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();
        }
    });
}
 
开发者ID:yanyiqun001,项目名称:goRefresh,代码行数:16,代码来源:RingProgressBar.java

示例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);
}
 
开发者ID:zendesk,项目名称:belvedere,代码行数:9,代码来源:ChatActivity.java

示例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;
}
 
开发者ID:BloopApp,项目名称:Bloop,代码行数:16,代码来源:BloopActivity.java

示例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();

}
 
开发者ID:SebastianRask,项目名称:Astro-Lockscreen,代码行数:32,代码来源:ExpandingUnlocker.java

示例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));
    }
}
 
开发者ID:qiujuer,项目名称:BeFoot,代码行数:9,代码来源:TouchPullView.java

示例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);
    }
}
 
开发者ID:thebigg73,项目名称:OpenSongTablet,代码行数:9,代码来源:PopUpSetViewNew.java

示例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);
	}
}
 
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:33,代码来源:FlyRefreshLayout.java

示例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);
    }
}
 
开发者ID:race604,项目名称:FlyRefresh,代码行数:35,代码来源:FlyRefreshLayout.java

示例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;
}
 
开发者ID:NicoLiutong,项目名称:miaosou,代码行数:11,代码来源:MultiDecelerateAccelerateInterpolator.java

示例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);
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:47,代码来源:Keyframe.java


注:本文中的android.support.v4.view.animation.PathInterpolatorCompat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。