ajout exo tp5
This commit is contained in:
13
R4.01_R4.A.10/td_tp/tp5/src/ex2/helper.js
Normal file
13
R4.01_R4.A.10/td_tp/tp5/src/ex2/helper.js
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user