14 lines
322 B
JavaScript
14 lines
322 B
JavaScript
const valueToPoint = (value, index, total) => {
|
|
const x = 0
|
|
const y = -value * 1.6
|
|
const angle = Math.PI * 2 / total * index
|
|
const cos = Math.cos(angle)
|
|
const sin = Math.sin(angle)
|
|
const tx = x * cos - y * sin + 200
|
|
const ty = x * sin + y * cos + 200
|
|
return {
|
|
x: tx,
|
|
y: ty
|
|
}
|
|
}
|