
因為上課還是要練習低 ~ 心血來潮寫看看愛心效果
反正就是利用 before & after 插在正方形的任意兩側 , 然後利用 transform rotate 旋轉大概就做出來了 XD ~
See the Pen
Heart by weber87na (@weber87na)
on CodePen.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
| <html lang="zh-Hant">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> <title>Document</title> <style> * { padding: 0; margin: 0; }
body { height: 100vh; display: flex; justify-content: center; align-items: center; margin: auto; background-color: #000;
}
.wrap { /* From https://css.glass */ width: 500px; height: 500px; background: rgba(255, 255, 255, 0.2); /* background-color: #fff; */ /* box-shadow: inset -300px 0 300px hotpink; */
border-radius: 50%; /* box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); */ backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); border: 1px solid rgba(255, 255, 255, 0.3); display: flex; align-items: center; justify-content: center; animation: 60s turn linear infinite; position: relative; /* overflow: hidden; */ }
@keyframes turn { to { transform: rotateY(-1turn); } }
.text { color: #fff; text-shadow: 0 0 50px #fff; transform: rotate(10deg); position: absolute; bottom: 20%; font-size: 72pt; z-index: -1; }
.heart { height: 60px; width: 60px; background-color: hotpink; position: relative; transform: rotate(45deg); box-sizing: content-box; }
.heart:nth-child(1) { animation: 3s move linear infinite; background-color: red; }
.heart:nth-child(1)::before { background-color: red; }
.heart:nth-child(1)::after { background-color: red; }
.heart:nth-child(2) { animation: 5s move2 linear infinite; }
.heart:nth-child(3) { animation: 4s move3 linear infinite; }
.heart:nth-child(4) { animation: 7s move4 linear infinite; }
.heart:nth-child(5) { animation: 2s move5 linear infinite; }
.heart::before { content: ''; position: absolute; height: 60px; width: 60px; top: 0; left: -30px; border-radius: 50%; background-color: hotpink; }
.heart::after { content: ''; position: absolute; height: 60px; width: 60px; top: -30px; left: 0px; border-radius: 50%; background-color: hotpink; }
@keyframes move5 { to { transform: scale(0.8) rotate(130deg); opacity: 0.4; } }
@keyframes move4 { to { transform: scale(1.8) rotate(80deg); opacity: 0.3; } }
@keyframes move3 { to { transform: scale(0.5) rotate(150deg); opacity: 0.4; } }
@keyframes move2 { to { transform: scale(1.1) rotate(130deg); opacity: 0.3; } }
@keyframes move { to { opacity: 0.5; transform: scale(1.5); } } </style> </head>
<body> <div class="wrap"> <div class="heart"></div> <div class="heart"></div> <div class="heart"></div> <div class="heart"></div> <div class="heart"></div> <div class="text">I Love U</div> </div> </body>
</html>
|