Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
How this svg can stop and start?

I'm browsing google io 2022 website and found nice motion. In this page, I can stop / start svg. Could someone explain how it works?

https://io.google/2022/about/intl/ko/

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Maybe something like this? But I don't know how to make it work with .gif.

 /* Toggle Animations */
 const start = document.getElementById('start');
 start.addEventListener('click', () => {
   const animations = document.querySelectorAll('[data-animation');
   animations.forEach(animation => {
     const running = animation.style.animationPlayState || 'running';
     animation.style.animationPlayState = running === 'running' ? 'paused' : 'running';
   })
 });
  .btn {
    background-color: blue;
    border: 0;
    border-radius: 0.25rem;
    color: #FFF;
    display: inline-block;
    margin-block-end: 0.5rem;
    padding: 1rem;
  }
 
  .box {
    --bgc: red;
    --w: 150px;
    align-items: center;
    background-color: var(--bgc);
    color: #FFF;
    display: flex;
    height: var(--w);
    justify-content: center;
    margin-bottom: 1rem;
    width: var(--w);
  }

  .slide {
    --animdur: 3s;
    --animn: slide;
  }
  [data-animation] {
    animation: var(--animn, none) var(--animdur, 0s) var(--animtf, linear) var(--animdel, 0s) var(--animic, infinite) var(--animdir, alternate) var(--animfm, none) var(--animps, running);
  }

  @keyframes slide {
    from { margin-left: 0%; }
    to { margin-left: calc(100% - var(--w, 150px)); }
  }
 <button id="start" class="btn" type="button">Start/Stop</button>
  <div class="box slide" data-animation="stop"></div>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda