Slide 12
Slide 12 text
for (hour in 0..23) {
val centerX = size.width / 2
val centerY = size.height / 2
val radius = (size.width / 2) - 50f
val lineLength = 20f
val angle = hour * (360 / 24) // 360度を24分割
val radian = Math.toRadians(angle.toDouble())
val startX = (centerX + radius * Math.cos(radian)).toFloat()
val startY = (centerY + radius * Math.sin(radian)).toFloat()
val endX = (centerX + (radius - lineLength) * Math.cos(radian)).toFloat()
val endY = (centerY + (radius - lineLength) * Math.sin(radian)).toFloat()
drawLine(
color = Color.Black,
start = Offset(x = startX, y = startY),
end = Offset(x = endX, y = endY),
cap = StrokeCap.Round,
strokeWidth = 3f
)
}