要使用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 bounceinright { 0% { opacity: 0; -webkit-transform: translatex(2000px); } 60% { opacity: 1; -webkit-transform: translatex(-30px); } 80% { -webkit-transform: translatex(10px); } 100% { -webkit-transform: translatex(0); } } @keyframes bounceinright { 0% { opacity: 0; transform: translatex(2000px); } 60% { opacity: 1; transform: translatex(-30px); } 80% { transform: translatex(10px); } 100% { transform: translatex(0); } } .bounceinright { -webkit-animation-name: bounceinright; animation-name: bounceinright; } </style> </head> <body> <div id="animated-example" class="animated bounceinright"></div> <button onclick="myfunction()">reload page</button> <script> function myfunction() { location.reload(); } </script> </body></html>
以上就是使用 css 实现正确的弹跳动画效果的详细内容。