我目前正在使用图形和路径,我可以成功地显示我想要的任何内容.
但是我不想直接在SurfaceView上画一条线,而是想在动画中逐步绘制它.
到目前为止我所做的是创建一个Path然后使用PathMeasure沿路径逐步检索坐标.这基本上是我到目前为止所做的
PathMeasure pm = new PathMeasure(myPath, false);
float position = 0;
float end = pm.getLength();
float[] coord = {0,0,0,0,0,0,0,0,0};
while (position < end){
Matrix m = new Matrix();
// put the current path position coordinates into the matrix
pm.getMatrix(position, m, PathMeasure.POSITION_MATRIX_FLAG | PathMeasure.TANGENT_MATRIX_FLAG);
// put the matrix data into the coord array (coord[2] = x and coord[5] = y)
m.getValues(coord);
????
position += 1;
}
Run Code Online (Sandbox Code Playgroud)
问号是我被困住的地方.我想逐步绘制路径,并在屏幕上看到它的动画.我在互联网上找不到关于它的很多信息,所以如果你已经遇到过同样的情况,任何线索都会非常感激.我想要创建的最终效果就像铅笔自动逐渐绘制文本.