Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
angleMode(DEGREES) in p5.js make no difference

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.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda