1
我看到這個項目,我一直在嘗試使動畫迭代計數:無限,但每次我嘗試文本重疊時,我想到的是讓文本每次重複一次時間停止在文本3.多文本動畫循環
@import 'https://fonts.googleapis.com/css?family=Baloo+Paaji';
$primary-color: #1e90ff;
$secondary-color: #ffe221;
$tertiary-color: #ffffff;
html, body {
height: 100%;
}
body {
font-family: 'Baloo Paaji', cursive;
background: #1e90ff;
display: flex;
justify-content: center;
align-items: center;
}
.container {
width: 100%;
height: 220px;
position: relative;
}
#color {
\t color: #ffe221;
}
h1, h2 {
font-size: 75px;
text-transform: uppercase;}
span {
width: 100%;
float: left;
color: #ffffff;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
transform: translateY(-50px);
opacity: 0;
animation-name: titleAnimation;
animation-timing-function: ease;
animation-duration: 3s;
}
h1 span {
animation-delay: 0.6s;
-webkit-animation-fill-mode: forwards;}
&:first-child {
animation-delay: 0.7s;
}
&:last-child {
color: #ffe221;
animation-delay: 0.5s;
}
}
.title {
\t margin: -4em 0 0 0;
}
h2 {
top: 0;
position: absolute;}
span {
animation-delay: 4.1s;
-webkit-animation-fill-mode: forwards;}
&:first-child {
animation-delay: 4.2s;
}
&:last-child {
color: #ffe221;
animation-delay: 4s;
}
h2 {
top: 0;
position: absolute;}
.slide-two{
animation-delay: 8.1s;
-webkit-animation-fill-mode: forwards;}
&:first-child {
animation-delay: 8.2s;
}
&:last-child {
color: #ffe221;
animation-delay: 8s;
}
@keyframes titleAnimation {
0% {
transform: translateY(-50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 80%);
}
20% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
80% {
transform: translateY(0);
opacity: 1;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 15%);
}
100% {
transform: translateY(50px);
opacity: 0;
-webkit-clip-path: polygon(100% 0, 100% -0%, 0 100%, 0 100%);
clip-path: polygon(100% 0, 100% -0%, 0 100%, 0 100%);
}
}
<html>
<head>
\t <link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<section class="container">
<h1 class="title">
<span>this is </span>
<span id="color">text one</span>
</h1>
<h2 class="title">
<span>and</span>
<span>this is <em id="color">text</em></span>
<span>two</span>
</h2>
<h2 class="slidetwo">
<span class="slide-two">while this </span>
<span id="color" class="slide-two">is</span>
<span class="slide-two">text three</span>
</h2>
</section>
</body>
</html>
試試這個屬性animation-iteration-count:infinite; –
每次我嘗試這個文本重疊,它是不可讀的。 –
你需要調整時間和延遲 –