我已经在图像中突出显示(红色)了我的问题;我想要设置蓝色指示器三角形的动画.
三角形在移动,但它没有正确移动.我不知道我错过了什么.
Timer Image with what I have achieved so far:
到目前为止,这是我的代码.
val center = Offset(size.width / 2f, size.height / 2f)
val beta = (250f * value + 145f) * (PI / 180f).toFloat()
val r = size.width / 2f
val a = cos(beta) * r
val b = sin(beta) * r
drawPoints(
listOf(Offset(center.x + a, center.y + b)),
pointMode = PointMode.Points,
color = Color.Gray,
strokeWidth = (strokeWidth * 2.2f).toPx(),
cap = StrokeCap.Round
)
drawPoints(
listOf(Offset(center.x + a, center.y + b)),
pointMode = PointMode.Points,
color = Color.White,
strokeWidth = (strokeWidth * 2f).toPx(),
cap = StrokeCap.Round
)
drawPoints(
listOf(Offset(center.x + a, center.y + b)),
pointMode = PointMode.Points,
color = PrimaryBlueColor,
strokeWidth = (strokeWidth * 1f).toPx(),
cap = StrokeCap.Round
)
drawImage(
image = vector,
topLeft = Offset(center.x + a, center.y + b)
)