1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> .root{ width: 600px; height: 600px; background-color: pink; margin: 30px auto; transform-style: preserve-3d; transform:rotateY(30deg) rotateX(30deg); } .root div{ width: 300px; height: 300px; position: absolute; top: 0; bottom: 0; left: 0; top: 0; margin: auto; } .one{ background-color: gold; animation: move 3s linear infinite; } @keyframes move{ 0%{ transform: translateZ(0); } 20%{ transform: translateZ(100px); } 40%{ transform: translateZ(0px); } 60%{ transform: translateZ(-100px); } 80%{ transform: translateZ(0px); } 100%{ transform: translateZ(0px); } } .two{ background-color: green; } </style> </head> <body> <div class="root"> <div class="one"></div> <div class="two"></div> </div> </body> </html>
|