3D跳動(dòng)愛(ài)心代碼html制作成品,如下:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>3D愛(ài)心跳動(dòng)代碼演示</title> <style> .heart { position:absolute; transform: rotate(-45deg); top: 50%; left: 50%; width: 100px; height: 100px; background: #c92929; transform-origin: 0 0; } .heart:before, .heart:after { content: ""; position:absolute; background-color:#c92929; } .heart:before { width: 100px; height: 100px; border-radius: 50% 0 0 50%; top:-50px; left:0; } .heart:after { width: 100px; height: 100px; border-radius: 0 50% 50% 0; top:0; left:50px; } .heart_beat { -webkit-animation: heart-beat 1s infinite; animation: heart-beat 1s infinite; opacity:1; } @-webkit-keyframes heart-beat { 0%,80%,100% {transform: scale(1);} 40% {transform: scale(0.8);} } @keyframes heart-beat { 0%,80%,100% {transform: scale(1);} 40% {transform: scale(0.8);} } </style> </head> <body> <div class="heart"></div> <script> setInterval(function () { document.querySelector('.heart').classList.toggle('heart_beat'); }, 600); </script> </body> </html>
以上就是3D跳動(dòng)愛(ài)心代碼html的全部?jī)?nèi)容。