我在一张简单的图片上使用CSS动画。
我希望脉冲动画只针对图像的一部分。
如何制作脉冲动画,以便只有文本"Trello“更改不透明度?
下面是我的代码:
.element {
/*animation-delay: 2s;*/
animation: pulse 3s infinite;
margin: 0 auto;
display: table;
margin-top: 50px;
animation-direction: alternate;
}
@keyframes pulse {
0% {
opacity: 1;
}
100% {
opacity: 0.3;
}
}
html,
body {
height: 100%;
background-color: #e74c3c;
}<img src="https://d78fikflryjgj.cloudfront.net/images/50b4ebc64391dc394a38e73aed57f0e2/header-logo.png" alt="" class="element" />
View on CodePen
发布于 2017-01-16 22:22:13
您可以将此示例用于这两种情况。我希望这对你有帮助。
.pulse {
animation: pulse 3s infinite;
margin: 0 auto;
display: table;
margin-top: 50px;
animation-direction: alternate;
-webkit-animation-name: pulse;
animation-name: pulse;
}
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
}
50% {
-webkit-transform: scale(1.1);
}
100% {
-webkit-transform: scale(1);
}
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
html,
body {
height: 100%;
background-color: #e74c3c;
}<img src="https://d78fikflryjgj.cloudfront.net/images/50b4ebc64391dc394a38e73aed57f0e2/header-logo.png" alt="" class="pulse" />
https://stackoverflow.com/questions/41677832
复制相似问题