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

200
Views
Efecto de transición entre dos estados del polígono svg al pasar el mouse

 function menuHover(navLI, Y) { const topTriangle = navLI.querySelector(".triangle").querySelector("polygon"); topTriangle.setAttribute("points", "0,0 200,0 100," + Y); } function navHoverIn(navLI) {menuHover(navLI, 60);} function navHoverOut(navLI) {menuHover(navLI, 10);}
 <div onmouseenter="navHoverIn(this)" onmouseleave="navHoverOut(this)"> <svg viewBox="0 0 200 60" class="triangle"> <polygon points="0,0 200,0 100,10"> </svg> </div>

Si pasa el cursor sobre el triángulo, los puntos de coordenadas del polígono cambian. ¿Alguna idea de cuál es la forma más conveniente de crear el efecto de transición entre los dos estados? Por lo tanto, no solo cambia instantáneamente, sino que tiene algún tipo de animación fácil.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puedes hacer todo esto en SMIL . No requiere javascript.

 <div> <svg viewBox="0 0 200 60" class="triangle"> <polygon points="0,0 200,0 100,10"> <animate begin="mouseover" attributeName="points" to="0,0 200,0 100,60" dur="1s" restart="whenNotActive" fill="freeze"/> <animate attributeName="points" begin="mouseout" dur="1s" fill="freeze" restart="whenNotActive" to="0,0 200,0 100,10"/> </polygon> </svg> </div>

about 4 years ago · Juan Pablo Isaza Report
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!