“我需要绘制一条过渡线(例如,从A点移动到B点),即一条路线,即该线不应突然出现,但它应该从一点到另一点绘制,就像我们看到一条加载线从左到右。我想画一条路线,将有多个转弯。”
我正在使用onDraw绘制线,但是它们突然间没有动画出现,我也在沿着线移动对象以获得效果。
@Override
protected void onDraw(Canvas canvas) {
Log.d("tag1", "42222");
for (AnimationThing thing : animationThingsList){
Log.d("tag1", "47777");
//!!! Only the path of the last thing will be drawn on screen
canvas.drawPath(thing.animPath, thing.paint);
if (thing.distance < thing.pathLength) {
thing.pathMeasure.getPosTan(thing.distance, thing.pos, thing.tan);
thing.matrix.reset();
float degrees = (float) (Math.atan2(thing.tan[1], thing.tan[0]) * 180.0 / Math.PI);
thing.matrix.postRotate(degrees, thing.bm_offsetX, thing.bm_offsetY);
thing.matrix.postTranslate(thing.pos[0] - thing.bm_offsetX, thing.pos[1] - thing.bm_offsetY);
canvas.drawBitmap(thing.bm, thing.matrix, null);
thing.distance += thing.step;
} else {
thing.distance = 0;
}
break;
}
invalidate();
}
当用户查看时,我需要一条带有被画的感觉的线条。