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

194
Views
Cómo dibujar una imagen en lugar de un color en lienzo para Agar.io

Actualmente estoy haciendo un clon de Agar.io basado en esto . Estoy atascado en hacer que aparezcan máscaras en lugar del color sólido aleatorio. Con el código actual, cuando selecciona una máscara, haciendo que config.skin sea verdadero, se congela y no puedo moverme, pero aún puedo chatear. Y todavía no tengo ninguna imagen dibujada.

config.skin es una cadena de imagen codificada en base64

el gráfico es el contexto 2d del lienzo

 if (config.skin) { graph.strokeStyle = "hsl(" + userCurrent.hue + ", 100%, 45%)"; graph.fillStyle = "hsl(" + userCurrent.hue + ", 100%, 50%)"; graph.lineWidth = playerConfig.border; var skin = new Image();//userCurrent.x - 2 * userCurrent.size, userCurrent.y - 2 * userCurrent.size); skin.src = config.skin; skin.onload = () => { // jshint ignore:line graph.beginPath(); graph.arc(userCurrent.h / 2, userCurrent.w / 2, userCurrent.radius, 0, Math.PI * 2, false); graph.clip(); graph.drawImage(skin, userCurrent.x - 2 * userCurrent.size, userCurrent.y - 2 * userCurrent.size); //, 4 * userCurrent.size, 4 * userCurrent.size); }; } else { graph.strokeStyle = "hsl(" + userCurrent.hue + ", 100%, 45%)"; graph.fillStyle = "hsl(" + userCurrent.hue + ", 100%, 50%)"; graph.lineWidth = playerConfig.border; }

código completo en github

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!