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


Java PathInterpolator类代码示例

本文整理汇总了Java中android.view.animation.PathInterpolator的典型用法代码示例。如果您正苦于以下问题:Java PathInterpolator类的具体用法?Java PathInterpolator怎么用?Java PathInterpolator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PathInterpolator类属于android.view.animation包,在下文中一共展示了PathInterpolator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClick

import android.view.animation.PathInterpolator; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@OnClick({R.id.bezier, R.id.go})
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.bezier:
            Intent intent = new Intent(InterpolatorPathActivity.this, BrizerActivity.class);
            startActivity(intent);
            break;
        case R.id.go:
            Path path = new Path();
            path.moveTo(X, Y);
            path.quadTo(800, Y, 800, 800);
            ObjectAnimator objectAnimator1 = new ObjectAnimator().ofFloat(image, "x", "y", path);
            objectAnimator1.setDuration(3000);
            objectAnimator1.setInterpolator(new PathInterpolator(0.9f, 0.1f, 0.5f, 0.9f));

            objectAnimator1.start();
            break;
    }
}
 
开发者ID:flyou,项目名称:PropertyAnimatorDemo,代码行数:21,代码来源:InterpolatorPathActivity.java

示例2: animateNavigationBarColor

import android.view.animation.PathInterpolator; //导入依赖的package包/类
private void animateNavigationBarColor(int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (navigationBarColorAnimator != null) navigationBarColorAnimator.cancel();
        navigationBarColorAnimator = ValueAnimator
                .ofArgb(getWindow().getNavigationBarColor(), color)
                .setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);
        navigationBarColorAnimator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
        navigationBarColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                AbsSlidingMusicPanelActivity.super.setNavigationbarColor((Integer) animation.getAnimatedValue());
            }
        });
        navigationBarColorAnimator.start();
    }
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:18,代码来源:AbsSlidingMusicPanelActivity.java

示例3: curved

import android.view.animation.PathInterpolator; //导入依赖的package包/类
private void curved(){
	Path path = new Path();
	//path.moveTo(view.getX(), view.getY());
	//path.lineTo(200, 200);
	//path.lineTo(600, 600);
	//path.arcTo(r,0,180,false);
	//path.rQuadTo(500,300,300,700);
	//path.cubicTo(100,100,500,300,300,700);
	//path.rCubicTo(100,100,500,300,300,700);
	//path.addArc(100,100,1000,700,-180,180);
	//path.cubicTo(100,100,200,200,300,300);
	path.moveTo(100,100);
	path.quadTo(1000,300,300,700);


	ObjectAnimator mAnimator = ObjectAnimator.ofFloat(curved, View.X, View.Y, path);

	Path p = new Path();
	p.lineTo(0.6f, 0.9f);
	p.lineTo(0.75f, 0.2f);
	p.lineTo(1f, 1f);
	mAnimator.setInterpolator(new PathInterpolator(p));

	mAnimator.setDuration(3000);
	mAnimator.start();
}
 
开发者ID:JamesKing9,项目名称:learn-newFeatures_Android_5.0,代码行数:27,代码来源:AnimationFragment.java

示例4: validateSetOfObjectAnimatorAlphaMotionTiming

import android.view.animation.PathInterpolator; //导入依赖的package包/类
@Test
public void validateSetOfObjectAnimatorAlphaMotionTiming() {
  MotionSpec spec =
      MotionSpec.createFromResource(
          activityTestRule.getActivity(), R.animator.valid_set_of_object_animator_motion_spec);
  MotionTiming alpha = spec.getTiming("alpha");

  assertEquals(3, alpha.getDelay());
  assertEquals(5, alpha.getDuration());
  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
    assertThat(alpha.getInterpolator(), instanceOf(PathInterpolator.class));
  } else {
    assertThat(alpha.getInterpolator(), instanceOf(FastOutLinearInInterpolator.class));
  }
  assertEquals(7, alpha.getRepeatCount());
  assertEquals(ValueAnimator.RESTART, alpha.getRepeatMode());
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:18,代码来源:MotionSpecTest.java

示例5: validateSetOfObjectAnimatorTranslationMotionTiming

import android.view.animation.PathInterpolator; //导入依赖的package包/类
@Test
public void validateSetOfObjectAnimatorTranslationMotionTiming() {
  MotionSpec spec =
      MotionSpec.createFromResource(
          activityTestRule.getActivity(), R.animator.valid_set_of_object_animator_motion_spec);
  MotionTiming translation = spec.getTiming("translation");

  assertEquals(11, translation.getDelay());
  assertEquals(13, translation.getDuration());
  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
    assertThat(translation.getInterpolator(), instanceOf(PathInterpolator.class));
  } else {
    assertThat(translation.getInterpolator(), instanceOf(FastOutSlowInInterpolator.class));
  }
  assertEquals(17, translation.getRepeatCount());
  assertEquals(ValueAnimator.REVERSE, translation.getRepeatMode());
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:18,代码来源:MotionSpecTest.java

示例6: animateViewColor

import android.view.animation.PathInterpolator; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void animateViewColor(View v, int startColor, int endColor) {

    ObjectAnimator animator = ObjectAnimator.ofObject(v, "backgroundColor",
            new ArgbEvaluator(), startColor, endColor);

    animator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
    animator.setDuration(COLOR_ANIMATION_DURATION);
    animator.start();
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:11,代码来源:Utils.java

示例7: create

import android.view.animation.PathInterpolator; //导入依赖的package包/类
public static Interpolator create(Path path) {
    return new PathInterpolator(path);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:PathInterpolatorCompatApi21.java

示例8: getInterpolator

import android.view.animation.PathInterpolator; //导入依赖的package包/类
private Interpolator getInterpolator(float startGradient, float velocityFactor) {
    if (startGradient != mCachedStartGradient
            || velocityFactor != mCachedVelocityFactor) {
        float speedup = mSpeedUpFactor * (1.0f - velocityFactor);
        mInterpolator = new PathInterpolator(speedup,
                speedup * startGradient,
                mLinearOutSlowInX2, mY2);
        mCachedStartGradient = startGradient;
        mCachedVelocityFactor = velocityFactor;
    }
    return mInterpolator;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:13,代码来源:FlingAnimationUtils.java

示例9: getDismissingProperties

import android.view.animation.PathInterpolator; //导入依赖的package包/类
private AnimatorProperties getDismissingProperties(float currValue, float endValue,
        float velocity, float maxDistance) {
    float maxLengthSeconds = (float) (mMaxLengthSeconds
            * Math.pow(Math.abs(endValue - currValue) / maxDistance, 0.5f));
    float diff = Math.abs(endValue - currValue);
    float velAbs = Math.abs(velocity);
    float y2 = calculateLinearOutFasterInY2(velAbs);

    float startGradient = y2 / LINEAR_OUT_FASTER_IN_X2;
    Interpolator mLinearOutFasterIn = new PathInterpolator(0, 0, LINEAR_OUT_FASTER_IN_X2, y2);
    float durationSeconds = startGradient * diff / velAbs;
    if (durationSeconds <= maxLengthSeconds) {
        mAnimatorProperties.interpolator = mLinearOutFasterIn;
    } else if (velAbs >= mMinVelocityPxPerSecond) {

        // Cross fade between linear-out-faster-in and linear interpolator with current
        // velocity.
        durationSeconds = maxLengthSeconds;
        VelocityInterpolator velocityInterpolator
                = new VelocityInterpolator(durationSeconds, velAbs, diff);
        InterpolatorInterpolator superInterpolator = new InterpolatorInterpolator(
                velocityInterpolator, mLinearOutFasterIn, Interpolators.LINEAR_OUT_SLOW_IN);
        mAnimatorProperties.interpolator = superInterpolator;
    } else {

        // Just use a normal interpolator which doesn't take the velocity into account.
        durationSeconds = maxLengthSeconds;
        mAnimatorProperties.interpolator = Interpolators.FAST_OUT_LINEAR_IN;
    }
    mAnimatorProperties.duration = (long) (durationSeconds * 1000);
    return mAnimatorProperties;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:33,代码来源:FlingAnimationUtils.java

示例10: createColorAnimator

import android.view.animation.PathInterpolator; //导入依赖的package包/类
private static Animator createColorAnimator(Object target, String propertyName, @ColorInt int startColor, @ColorInt int endColor) {
    ObjectAnimator animator;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        animator = ObjectAnimator.ofArgb(target, propertyName, startColor, endColor);
    } else {
        animator = ObjectAnimator.ofInt(target, propertyName, startColor, endColor);
        animator.setEvaluator(new ArgbEvaluator());
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        animator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
    }
    animator.setDuration(PHONOGRAPH_ANIM_TIME);
    return animator;
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:16,代码来源:ViewUtil.java

示例11: create

import android.view.animation.PathInterpolator; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static Interpolator create(Path path) {
    return new PathInterpolator(path);
}
 
开发者ID:liuwei1993,项目名称:AndroidAnimationTools,代码行数:5,代码来源:PathInterpolatorCompatApi21.java

示例12: create

import android.view.animation.PathInterpolator; //导入依赖的package包/类
public static Interpolator create(
    float controlX1, float controlY1, float controlX2, float controlY2) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    return new PathInterpolator(controlX1, controlY1, controlX2, controlY2);
  }
  return new PathInterpolatorBase(controlX1, controlY1, controlX2, controlY2);
}
 
开发者ID:dialogs,项目名称:android-dialer,代码行数:8,代码来源:PathInterpolatorCompat.java

示例13: create

import android.view.animation.PathInterpolator; //导入依赖的package包/类
public static Interpolator create(float controlX, float controlY) {
    return new PathInterpolator(controlX, controlY);
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:4,代码来源:PathInterpolatorCompatApi21.java

示例14: animateNavigationBarColor

import android.view.animation.PathInterpolator; //导入依赖的package包/类
private void animateNavigationBarColor(int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (navigationBarColorAnimator != null) navigationBarColorAnimator.cancel();
        navigationBarColorAnimator = ValueAnimator.ofArgb(getWindow().getNavigationBarColor(), color).setDuration(ViewUtil.RETRO_MUSIC_ANIM_TIME);
        navigationBarColorAnimator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
        navigationBarColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                AbsSlidingMusicPanelActivity.super.setNavigationbarColor((Integer) animation.getAnimatedValue());
            }
        });
        navigationBarColorAnimator.start();
    }
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:16,代码来源:AbsSlidingMusicPanelActivity.java

示例15: getOutputPointsForNewerDevices

import android.view.animation.PathInterpolator; //导入依赖的package包/类
private static int[] getOutputPointsForNewerDevices(Point[] knots) {

        Point[] controlPoints = calculateControlPoints(knots);
        Path path = new Path();
        path.moveTo(0, 0);
        path.lineTo(knots[0].x / 255.0f, knots[0].y / 255.0f);
        path.moveTo(knots[0].x / 255.0f, knots[0].y / 255.0f);

        for (int index = 1; index < knots.length; index++) {
            path.quadTo(
                    controlPoints[index - 1].x / 255.0f,
                    controlPoints[index - 1].y / 255.0f,
                    knots[index].x / 255.0f,
                    knots[index].y / 255.0f
            );
            path.moveTo(knots[index].x / 255.0f, knots[index].y / 255.0f);
        }

        path.lineTo(1, 1);
        path.moveTo(1, 1);

        float[] allPoints = new float[256];

        for (int x = 0; x < 256; x++) {
            PathInterpolator pathInterpolator = new PathInterpolator(path);
            allPoints[x] = 255.0f * pathInterpolator.getInterpolation((float) x / 255.0f);
        }

        allPoints[0] = knots[0].y;
        allPoints[255] = knots[knots.length - 1].y;
        return validateCurve(allPoints);
    }
 
开发者ID:Zomato,项目名称:AndroidPhotoFilters,代码行数:33,代码来源:BezierSpline.java


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