Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
La función P5.js curveVertex se está cerrando en un punto

Creé una función de ruido que se combina con una función de círculo para crear un círculo de ruido aleatorio que se ve muy bien. Mi problema es que la función curveVertex en P5.js funciona correctamente excepto por la conexión del primer y último vértice. mi código es:

 let start = Array(50).fill(0); // dont change let amount = 1; // amount of shapes let gap = 30; // between shapes let amplify = 50; // 0 --> let colorSpeed = 1; // 1 - 9 let colorSeparation = 3; // 0 - 80 recomended 0 - 10 function setup() { createCanvas(windowWidth, windowHeight); for(let i = 0 ; i < start.length; i++){ start[i] = random(i); } } function draw() { background(0); for(let dnc = (amount + 1) * gap; dnc > gap; dnc -= gap){ drawNoiseCircle(dnc, getNoise(start.length)); } start = start.map( c => c + 0.01 ); } function getNoise(amount){ let lengths = []; for(let i = 1; i < amount + 1; i++){ let n1 = noise(start[i - 1]); let noise1 = map(n1, 0, 1, -amplify, amplify); lengths.push(abs(-noise1)); } return lengths; } function drawNoiseCircle(radius, lengths){ colorMode(HSB); fill(((frameCount + radius) * colorSeparation)/-map(colorSpeed, 1, 10, -10, -1) % 360, 100, 50); noStroke() let x; let y; beginShape(); for(let l = 0; l < lengths.length; l++){ x = Math.cos(radians(l * 360 / lengths.length)) * (radius + lengths[l]) + width/2; y = Math.sin(radians(l * 360 / lengths.length)) * (radius + lengths[l]) + height/2; curveVertex(x, y); } endShape(CLOSE); stroke("black"); line(width/2, height/2, width, height/2); line(width/2, height/2 + 9, width, height/2 + 9); }
 <script src="https://cdn.jsdelivr.net/npm/p5@1.4.1/lib/p5.js"></script>

Entiendo que endShape(CLOSED) cierra la forma con una línea recta, pero no estoy seguro de otra forma de cerrar la forma.

Puede ver el borde puntiagudo en el lado derecho, directamente en el medio de la forma.

!¡EDITAR!

Agregué líneas a la forma para mostrar el segmento de línea que no se ve afectado por el vértice de la curva. Además, entiendo que puede no ser un problema muy importante, pero si la cantidad de vértices se reduce, se convierte en un problema mucho mayor (por ejemplo, un cuadrado o un triángulo).

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!