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

107
Views
Título giratorio de JavaScript

Este script que estoy usando crea un efecto de texto giratorio para un título en un sitio que estoy construyendo. Quiero aumentar la velocidad a la que giran gradualmente, por lo que comienza lento, aumenta gradualmente la velocidad, mantiene la velocidad máxima de, digamos, 7x original y luego vuelve lentamente al ritmo inicial y lo hace en un ciclo.

El tiempo que se tarda en girar se establece actualmente al final de la función en el área '1200', por lo que supongo que debería provenir de una variable y tener ese comportamiento almacenado dentro de la función. Acabo de perder en dónde ir a continuación.

 setInterval(() => { const up = document.querySelector('.span-one[data-up]'); const show = document.querySelector('.span-one[data-show]'); const down = show.nextElementSibling || document.querySelector('.span-one:first- child'); up.removeAttribute('data-up'); show.removeAttribute('data-show'); show.setAttribute('data-up', ''); down.setAttribute('data-show', ''); }, 1200);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Aquí hay un código que puede ayudarlo. Tenga en cuenta que los estilos se aplican en un elemento simple. En su código también debe tener en cuenta el contexto.

 /* Here you defined the animation. You can play around more and adjust the speed as you want */ @keyframes example { /* Here are some options */ /* uncomment the sections to experiment */ /* 0% { transform: rotate(0deg); } 25% { transform: rotate(90deg); } 50% { transform: rotate(120deg); } 75% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } */ /* 0% { transform: rotate(0deg); } 25% { transform: rotate(80deg); } 50% { transform: rotate(180deg); } 75% { transform: rotate(290deg); } 100% { transform: rotate(360deg); } */ 0% { transform: rotate(0deg); } 50% { transform: rotate(100deg); } 75% { transform: rotate(300deg); } 100% { transform: rotate(360deg); } /* You can google about the animations and how these percentages work, but actually its pretty simple */ } .rotating { /* This is optional, but needed if your title is block level element, just play around and see the differnce */ display: inline-block; /* this is mandatory */ animation-name: example; animation-duration: 5s; animation-iteration-count: infinite; }
 <html> <body> <h1 class="rotating">My Dear Rotating Title</h1> </body> </html>

Stackoverflow es demasiado estricto al pegar el enlace a jsfiddle, así que lo incrusté aquí

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!