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

255
Views
Comportamiento inesperado del lienzo al usar el estilo de trazo

Estoy tratando de borrar una línea dibujando otra encima en el lienzo HTML. Pero la segunda línea se vuelve semitransparente por alguna razón desconocida para mí.

índice.html

 <!DOCTYPE html> <head> <script src="scripts.js" type="text/javascript"></script> </head> <html> <body onload = "onload()"> <canvas id = "canvas" style="border: solid 1px; width: 200px; height: 200px;"></canvas> </body> </html>

scripts.js

 var canvas,ctx; const onload = () =>{ canvas = document.querySelector("#canvas") ctx = canvas.getContext('2d') drawLine("#ff0000") drawLine("#ffffff") } const drawLine = (color) =>{ ctx.beginPath() ctx.strokeStyle = color ctx.moveTo(0,0) ctx.lineTo(200,200) ctx.stroke() ctx.closePath() } 

 var canvas,ctx; const onload = () =>{ canvas = document.querySelector("#canvas") ctx = canvas.getContext('2d') drawLine("#ff0000") drawLine("#ffffff") } const drawLine = (color) =>{ ctx.beginPath() ctx.strokeStyle = color ctx.moveTo(0,0) ctx.lineTo(200,200) ctx.stroke() ctx.closePath() }
 <!DOCTYPE html> <head> <script src="scripts.js" type="text/javascript"></script> </head> <html> <body onload = "onload()"> <canvas id = "canvas" style="border: solid 1px; width: 200px; height: 200px;"></canvas> </body> </html>

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!