本文整理汇总了Java中android.view.animation.PathInterpolator.getInterpolation方法的典型用法代码示例。如果您正苦于以下问题:Java PathInterpolator.getInterpolation方法的具体用法?Java PathInterpolator.getInterpolation怎么用?Java PathInterpolator.getInterpolation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.PathInterpolator
的用法示例。
在下文中一共展示了PathInterpolator.getInterpolation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}