Home > Web Front-end > CSS Tutorial > How to Apply CSS Animation Delay to All Iterations?

How to Apply CSS Animation Delay to All Iterations?

Susan Sarandon
Release: 2024-12-19 01:58:09
Original
898 people have browsed it

How to Apply CSS Animation Delay to All Iterations?

CSS Animation Delay: Application to All Iterations

When using CSS animations with a delay, you might encounter an issue where the delay is only applied to the first iteration, causing the animation to continuously repeat without the desired interval.

To resolve this issue, you can employ a different approach:

@keyframes expbarshine {
  from {background-image:linear-gradient(120deg,rgba(255,255,255,0) -10%,rgba(255,255,255,0.25) -5%,rgba(255,255,255,0) 0%);}
  80% {background-image:linear-gradient(120deg,rgba(255,255,255,0) -10%,rgba(255,255,255,0.25) -5%,rgba(255,255,255,0) 0%);}
  to {background-image:linear-gradient(120deg,rgba(255,255,255,0) 100%,rgba(255,255,255,0.25) 105%,rgba(255,255,255,0) 110%);}
}
Copy after login

Here, the 80% keyframe is identical to the from keyframe, effectively creating a "delay" of 80% of the full animation length.

As suggested by an experienced user, you could also use the following approach:

@-webkit-keyframes pan {
   0%, 10%       { -webkit-transform: translate3d( 0%, 0px, 0px); }
   90%, 100%     { -webkit-transform: translate3d(-50%, 0px, 0px); }
}
Copy after login

This method involves creating a fake duration to accommodate the "delays" at both ends of the animation.

The above is the detailed content of How to Apply CSS Animation Delay to All Iterations?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template