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

181
Views
¿Hay alguna forma de crear una línea usando fillRect en JS (canvas)?

Estoy probando un tutorial de YouTube, y cuando uso el siguiente fragmento, crea un punto/píxel en el lienzo. Puedo recrear la función varias veces con diferentes valores para crear una línea, pero ¿es posible crear una línea recta usando el siguiente código?

Disculpas por la pregunta simple, soy bastante nuevo en el uso de lienzo. Gracias

 let tileCount = 20; //total tiles = 20. or you can say pixels body let tileSize = canvas.width / tileCount - 2; let appleX = 5; let appleY = 5; function drawApple() { //craetes the food item for snake to collide ctx.fillStyle = "red"; //color of apple ctx.fillRect(appleX * tileCount, appleY * tileCount, tileSize, tileSize); //defining apple as rectangle }
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!