使用 CSS 淡入左侧动画效果
-
WBOY
转载
-
2023-09-17 14:29:10
641浏览
![使用 CSS 淡入左侧动画效果](//m.sbmmt.com/img/upload/article/000/887/227/169493215266758.jpg)
要在图像上使用CSS实现从左边淡入的动画效果,您可以尝试运行以下代码 −
<html>
<head>
<style>
.animated {
background-image: url(/css/images/logo.png);
background-repeat: no-repeat;
background-position: left top;
padding-top:95px;
margin-bottom:60px;
-webkit-animation-duration: 10s;
animation-duration: 10s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
@-webkit-keyframes fadeInLeft {
0% {
opacity: 0;
-webkit-transform: translateX(-20px);
}
100% {
opacity: 1;
-webkit-transform: translateX(0);
}
}
@keyframes fadeInLeft {
0% {
opacity: 0;
transform: translateX(-20px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
.fadeInLeft {
-webkit-animation-name: fadeInLeft;
animation-name: fadeInLeft;
}
animation-name: fadeInDown;
</style>
</head>
<body>
<div id="animated-example" class="animated fadeInLeft"></div>
<button onclick="myFunction()">Reload page</button>
<script>
function myFunction() {
location.reload();
}
</script>
</body>
</head>
以上就是使用 CSS 淡入左侧动画效果的详细内容,更多请关注php中文网其它相关文章!
声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除