public void matchVertsToPath(Path path, float extraOffset) {
PathMeasure pm = new PathMeasure(path, false);
int index = 0;
for (int i = 0; i < staticVerts.length / 2; i++) {
float yIndexValue = staticVerts[i * 2 + 1];
float xIndexValue = staticVerts[i * 2];
float percentOffsetX = (0.000001f + xIndexValue) / bitmap.getWidth();
float percentOffsetX2 = (0.000001f + xIndexValue) / (bitmap.getWidth() + extraOffset);
percentOffsetX2 += pathOffsetPercent;
pm.getPosTan(pm.getLength() * (1f - percentOffsetX), coords, null);
pm.getPosTan(pm.getLength() * (1f - percentOffsetX2), coords2, null);
if (yIndexValue == 0) {
setXY(drawingVerts, i, coords[0], coords2[1] + verticalOffset);
} else {
float desiredYCoord = Math.max(coords2[1], coords2[1] + easedFoamCoords[Math.min(easedFoamCoords.length - 1, index)]);
setXY(drawingVerts, i, coords[0], desiredYCoord + verticalOffset);
index += 1;
}
}
}
Foam.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:Depth
作者:
评论列表
文章目录