I made a clock sketch using p5.Up till now, only the seconds needle has been added. But when I started the project, I had no idea that it ran in radians. Now I want to convert it to degrees, I tried the following:
d = new Date()
h = d.getHours()
s = d.getSeconds()
let c
let stheta = 90
let r
function setup() {
c = createCanvas(400, 400);
r = c.height/2
}
function draw() {
background(220);
translate(c.width/2,c.height/2)
strokeWeight(1)
circle(0,0,c.height+5)
strokeWeight(5)
point(0,0)
angleMode(DEGREES)
line(0,0,Math.sin(stheta)*r,Math.cos(stheta)*r)
}
setInterval(()=>{
stheta+=6
},1000)
But this did not yield the same result. Here is the sketch for what I tried with degrees. How can I turn it to degrees? Thanks in advance.