Пример:
HTML:
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 |
<div class="bunny-container"> <div> <div class="grass"></div> <div class="bunny"> <div class="bunny__ears"> <div class="bunny__ear bunny__ear--left"></div> <div class="bunny__ear bunny__ear--right"></div> </div> <div class="bunny__feet"> <div class="bunny__foot bunny__foot--left"></div> <div class="bunny__foot bunny__foot--right"></div> </div> <div class="bunny__tail"></div> <div class="bunny__paw"></div> <div class="bunny__body"> <div class="bunny__eyes"></div> <div class="bunny__nose"></div> <div class="bunny__cheeks"></div> <div class="bunny__mouth"></div> </div> </div> </div> <div class="bubbles"> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> <div class="bubble"></div> </div> </div> |
CSS:
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 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
:root { --bunny-color: pink; --bunny-color-2: #f0a4cb; --bunny-eye-color: #473929; --bunny-cheek-color: red; --bunny-tongue-color: red; --bunny-mouth-color: #473929; --bunny-nose-color: #473929; --stick-color: #ff8819; --stick-bubble-color-1: #9e9eff; --stick-bubble-color-2: white; --grass-color: #84cc84; --grass-color-2: lightgreen; --breathe-duration: 10s; --bubble-color-1: #4fd5e7; --bubble-color-2: #829fff; --bubble-color-3: #76e0cf; --bubble-color-4: #86befd; --bubble-color-5: #91f1d9; } .bunny-container { margin: 0; background: #FFF; display: flex; justify-content: center; align-items: center; font-family: 'Balsamiq Sans', cursive; height: 300px; padding-bottom: 80px; } .bunny { width: 230px; height: 300px; transform: translateX(70px); position: relative; } .bunny * { position: absolute; } .bunny__body { width: 200px; height: 200px; background: var(--bunny-color); border-radius: 100px 100px 30px 0px; transform: translateY(80px); } @keyframes eyesAnim { 0%, 15%, 17%, 79%, 81% { transform: translate(40px, 40px) rotateZ(6deg) } 16%, 80% { transform: translate(40px, 40px) rotateZ(6deg) scaleY(0.3) } 60% { transform: translate(40px, 30px) rotateZ(6deg) } 10%, 70%, 100% { transform: translate(40px, 40px) rotateZ(6deg) } } .bunny__eyes { padding: 6px; background: var(--bunny-eye-color); border-radius: 50%; box-shadow: 80px 0 var(--bunny-eye-color); transform: translate(40px, 40px) rotateZ(6deg); animation: eyesAnim var(--breathe-duration) linear infinite; } @keyframes noseAnim { 60% { transform: translate(70px, 40px) } 10%, 70%, 100% { transform: translate(70px, 50px) } } .bunny__nose { padding: 5px 8px; background: var(--bunny-nose-color); border-radius: 50%; transform: translate(70px, 50px); animation: noseAnim var(--breathe-duration) linear infinite; } .bunny__nose::after { content: '|'; text-shadow: 1px 0px, -1px 0; color: var(--bunny-nose-color); position: absolute; font-size: 20px; font-weight: bolder; transform: translateX(-2px); } @keyframes cheeksAnim { 60% { transform: translate(10px, 50px) rotateZ(5deg); opacity: 0.5 } 10%, 70%, 100%, 0% { transform: translate(10px, 55px) rotateZ(5deg); opacity: 0.2 } } .bunny__cheeks { padding: 18px; background: var(--bunny-cheek-color); border-radius: 50%; transform: translate(10px, 55px) rotateZ(5deg); box-shadow: 110px 0 var(--bunny-cheek-color); animation: cheeksAnim var(--breathe-duration) linear infinite; } @keyframes breatheMouthAnim { 0%, 10%, 75%, 78%, 82%, 86%, 90%, 94%, 98%, 100%, 4%, 8% { transform: translate(68px, 70px) } 60% { transform: translate(70px, 70px) scale(3, 2.5) } 76%, 80%, 84%, 88%, 92%, 96%, 2%, 6% { transform: translate(66px, 70px) } } .bunny__mouth { padding: 8px 10px; background: var(--bunny-tongue-color); border-radius: 50%; transform: translate(66px, 70px); box-shadow: inset 5px 8px var(--bunny-mouth-color); animation: breatheMouthAnim var(--breathe-duration) linear infinite; } .bunny__ears { width: 200px; height: 100px; } @keyframes earLeftAnim { 0%, 10%, 75% { transform: var(--transform-3) } 15%, 17%, 65% { transform: var(--transform-1) } 16% { transform: var(--transform-2) } 25%, 29%, 42%, 46%, 56%, 60% { transform: var(--transform-4) } 23%, 27%, 31%, 40%, 44%, 48%, 54%, 58%, 62% { transform: var(--transform-1) } } @keyframes earRightAnim { 0%, 10%, 75% { transform: var(--transform-3) } 13%, 15%, 65% { transform: var(--transform-1) } 14% { transform: var(--transform-2) } 28%, 32%, 44%, 48%, 55%, 59% { transform: var(--transform-4) } 26%, 30%, 34%, 42%, 46%, 50%, 53%, 57%, 61% { transform: var(--transform-1) } } .bunny__ear { width: 50px; height: 100px; border-radius: 50% 50% 0%; background: var(--bunny-color); transform-origin: bottom left; box-shadow: inset 0px 15px var(--bunny-color-2); transform: var(--transform-3); } .bunny__ear--left { --transform-1: translateX(50px) rotate(10deg); --transform-2: translateX(50px) rotate(5deg); --transform-3: translateX(50px) rotate(30deg); --transform-4: translateX(50px) rotate(8deg); animation: earLeftAnim var(--breathe-duration) linear infinite; } .bunny__ear--right { --transform-1: translateX(125px) rotate(25deg); --transform-2: translateX(125px) rotate(20deg); --transform-3: translateX(125px) rotate(45deg); --transform-4: translateX(125px) rotate(23deg); animation: earRightAnim var(--breathe-duration) linear infinite; } .bunny__feet { height: 35px; width: 200px; transform: translateY(265px); } .bunny__foot { height: 35px; width: 65px; background: var(--bunny-color-2); border-radius: 0 0 25px 50%; } .bunny__foot--left { transform: rotate(10deg) skewY(-20deg); } .bunny__foot--right { transform: translateX(110px) rotate(10deg) skewY(-20deg); } @keyframes tailAnim { 0%, 15%, 25%, 75%, 85%, 95% { transform: translate(190px, 200px) rotate(8deg) } 20%, 80%, 90% { transform: translate(190px, 198px) rotate(-8deg) } } .bunny__tail { height: 50px; width: 40px; background: var(--bunny-color-2); border-radius: 50% 50% 50%; transform: translate(190px, 200px) rotate(8deg); animation: tailAnim 3s linear infinite; } .bunny__arm { width: 80px; height: 100px; transform: translate(-70px, 140px); } @keyframes pawAnim { 0%, 75%, 100% { transform: translate(-47px, 197px) rotate(-2deg) } 65% { transform: translate(-47px, 197px) rotate(10deg) } } .bunny__paw { width: 50px; height: 50px; background: var(--bunny-color); border-radius: 50px 0 0 50px; transform-origin: bottom right; transform: translate(-47px, 197px) rotate(-2deg); transform: translate(-47px, 197px) rotate(10deg); animation: pawAnim var(--breathe-duration) linear infinite; } .bunny__paw::before { content: ''; position: absolute; width: 10px; height: 45px; border-radius: 0 0 20px 20px; background: var(--stick-color); transform: translate(8px, -5px); } .bunny__paw::after { content: ''; position: absolute; width: 19px; height: 35px; background: linear-gradient(-45deg, var(--stick-bubble-color-1) 0% 30%, var(--stick-bubble-color-2) 30% 40%, var(--stick-bubble-color-1) 40% 55%, var(--stick-bubble-color-2) 55% 60%, var(--stick-bubble-color-1) 60% 100%); border-radius: 50%; box-shadow: 0 0 0 8px var(--stick-color); transform: translate(2px, -45px); } .grass { width: 300px; height: 70px; background: var(--grass-color); position: absolute; border-radius: 50%; transform: translateY(260px); box-shadow: 0 6px 0 16px var(--grass-color-2); } .bubbles { position: absolute; transform: translate(-130px, 15px); } @keyframes bubbleAnim { 40% { offset-distance: 0% } 60% { offset-distance: 100%; } 42%, 58% { opacity: 1 } 0%, 40%, 60%, 100% { opacity: 0 } } .bubble { position: absolute; border-radius: 50%; opacity: 0; animation: bubbleAnim var(--breathe-duration) linear infinite; --bubble-base-delay: 3s; --bubble-delay: 0.2s; } .bubble:nth-child(n) { background: var(--bubble-color-1); padding: 12px; transform: rotate(10deg); offset-path: path('m0,0 l -500, -35'); } .bubble:nth-child(2n) { background: var(--bubble-color-2); padding: 8px; offset-path: path('m0,0 l -500, -25'); } .bubble:nth-child(3n) { background: var(--bubble-color-3); padding: 15px; offset-path: path('m0,0 l -500, 10'); } .bubble:nth-child(4n) { background: var(--bubble-color-4); padding: 10px; offset-path: path('m0,0 l -500, 30'); } .bubble:nth-child(5n) { background: var(--bubble-color-5); padding: 17px; offset-path: path('m0,0 l -500, 20'); } .bubble:nth-child(1) { animation-delay: var(--bubble-base-delay) } .bubble:nth-child(2) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay)) } .bubble:nth-child(3) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 2) } .bubble:nth-child(4) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 3) } .bubble:nth-child(5) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 4) } .bubble:nth-child(6) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 5) } .bubble:nth-child(7) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 6) } .bubble:nth-child(8) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 7) } .bubble:nth-child(9) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 8) } .bubble:nth-child(10) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 9) } .bubble:nth-child(11) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 10) } .bubble:nth-child(12) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 11) } .bubble:nth-child(13) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 12) } .bubble:nth-child(14) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 13) } .bubble:nth-child(15) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 14) } .bubble:nth-child(16) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 15) } .bubble:nth-child(17) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 16) } .bubble:nth-child(18) { animation-delay: calc(var(--bubble-base-delay) + var(--bubble-delay) * 17) } .bubble::before, .bubble::after { content: ''; position: absolute; border-radius: 50%; background: white; } .bubble::after { padding: 15%; opacity: 0.6; } .bubble::before { padding: 10%; opacity: 0.7; transform: translate(-6px, -1px); } |
Переменные:
--bunny-color
- цвет кролика
--bunny-color-2
- цвет конечностей кролика (уши и лапы)
--bunny-eye-color
- цвет глаз кролика
--bunny-cheek-color
- цвет румян кролика с прозрачностью
--bunny-tongue-color
- цвет языка кролика
--bunny-mouth-color
- цвет рта кролика
--bunny-nose-color
- цвет носа кролика
--stick-color
- цвет корпуса мыльнопузыренадувателя
--stick-bubble-color-1
- цвет решетки мыльнопузыренадувателя 1
--stick-bubble-color-2
- цвет решетки мыльнопузыренадувателя 2
--grass-color
- цвет травы 1
--grass-color-2
- цвет травы 2
--breathe-duration
- скорость, с которой кролик дует
--bubble-color-1
- цвет пузырей 1
--bubble-color-2
- цвет пузырей 2
--bubble-color-3
- цвет пузырей 3
--bubble-color-4
- цвет пузырей 4
--bubble-color-5
- цвет пузырей 5
Найдено на codepen.io у пользователя Wendy Kong
Добавить комментарий: