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

142
Views
¿Cómo cambio ctx.fillStyle cuando cambia la URL?

así que estoy experimentando con dibujos 2d en Javascript y lo que estoy tratando de hacer es cambiar el ctx.fillStyle (que es el color del dibujo) y cambiarlo a otro color cuando cambia la URL.

Cualquier ayuda sería muy apreciada. Aquí hay una parte de mi código:

El enlace de codepen para la animación: https://codepen.io/LudovicTomlo/pen/PEWEwJ

 window.draw = setInterval(function() { ctx.fillStyle = "rgba(0, 0, 0, 0.1)"; ctx.fillRect(0, 0, c.width, c.height); ctx.fillStyle = "#00ff00"; ctx.font = font_size + "px Sawarabi Gothic"; if(location.pathname.endsWith("/401?e=1")) { ctx.fillStyle = "rgba(0, 0, 0, 0.1)"; ctx.fillRect(0, 0, c.width, c.height); ctx.fillStyle = "#ff0000"; ctx.font = font_size + "px Sawarabi Gothic"; } for(var i = 0; i < rain.length; i++) { // random character from the set var text = chars[Math.floor(Math.random()*chars.length)]; ctx.fillText(text, i*font_size, rain[i]*font_size); if(rain[i]*font_size > c.height && Math.random() > 0.975) { rain[i] = 0; } //incrementing Y coordinate rain[i]++; } }, speed);

}

about 4 years ago · Santiago Trujillo
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!