Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
Start animation from right when leaving screen

I want to have an animation that starts in the center but loops infinitely. As you can see in the snippet the cubes first start in the center, dispersed evenly across the width, but what I want is that the moment the cube leaves the screen on the left, it starts back at the right, so it is seamless. Anyone knows how to do this?

Here's the code:

#skillIcon {
  animation: moveLeft 5s linear infinite;
  width:100px;
  height:100px;
  background-color:#444;
  align-items:center;
  position:relative;
}

@-webkit-keyframes moveLeft {
  from {
    right: -30%;
  }
  to {
    right: 100%;
  }
}

#parentDiv{
background-color:#222;
display:flex;
position:relative;
justify-content:space-between;
align-items:center;
}
<div id="parentDiv">
<div id="skillIcon">
</div>
<div id="skillIcon">
</div>
<div id="skillIcon">
</div>
</div>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you're on the right track, the keys frames is the trick

@keyframes example {
  0%   {left:50%;}
  50% {left:-30%;}
  50.01% {left:130%;}
  100%  {left:50%;}
}

div {
  width: 10px;
  height: 10px;
  position: relative;
  left:50%;
  background-color: red;
  animation: example 4s linear infinite;
}

edited:

I found a better solution Using just 2 keyframes and setting delay you can have it start anywhere on the screen.

@keyframes example {
  0%   {left:110%;}
  100%  {left:-10%;}
}

div {
  width: 10px;
  height: 10px;
  position: relative;
  left:0%;
  background-color: red;
  animation: example 4s linear infinite;
}

then ethier in css on on the div itself set a delay -2 secs on a 4 secs loop will start in the centre of element.

<div style="animation-delay:-2s"/>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda