Virtual dj аудиопроигрыватель с помощью CSS3
Virtual DJ — это отличная программа, которая превратит Ваш персональный компьютер в продвинутую DJ-студию. Обладая превосходными инструментами микширования МР3 файлов в режиме реального времени, а также огромным количеством эффектов, специальных примочек, шаблонов и переходов. Но если вы хотели бы сделать муляж такого проигрывателя у себя на сайте, просто для того чтобы красочно преподнести посетителю музыку которая играет у вас на сайте, тогда этот урок вас заинтересует. В нем мы рассмотрим как сделать такой проигрыватель с помощью css3.
Такой плеер отлично подойдет для сайта-портфолио, или для какого-нибудь диджея, который решил оформить свой персональный блог. И так, приступим.
Шаг 1. HTML
Для начала мы рассмотрим разметку 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 |
Virtual dj проигрыватель с помощью CSS3 | Демонстрация для сайта RUDEBOX </pre> <div class="vdj"><img src="images/back.jpg" alt="" /> <img class="v1" src="images/v1.png" alt="" /> <img class="v2" src="images/v2.png" alt="" /> <img class="v3" src="images/v3.png" alt="" /> <img class="v4" src="images/v4.png" alt="" /> <img class="s1" src="images/speaker.png" alt="" /> <img class="si1" src="images/speaker-in.png" alt="" /> <img class="s2" src="images/speaker.png" alt="" /> <img class="si2" src="images/speaker-in.png" alt="" /> <img class="s3" src="images/speaker.png" alt="" /> <img class="si3" src="images/speaker-in.png" alt="" /> <img class="s4" src="images/speaker.png" alt="" /> <img class="si4" src="images/speaker-in.png" alt="" /> <img class="slid1" src="images/slid1.png" alt="" /> <img class="slid2" src="images/slid1.png" alt="" /> <img class="b1" src="images/but1.png" alt="" /> <img class="b2" src="images/but2.png" alt="" /> <img class="b3" src="images/but3.png" alt="" /> <img class="b4" src="images/but1.png" alt="" /> <img class="b5" src="images/but2.png" alt="" /> <img class="b6" src="images/but3.png" alt="" /> <img class="eq" src="images/space.gif" alt="" /> <img class="eq2" src="images/space.gif" alt="" /></div> <pre> <script type="text/javascript">// <![CDATA[ (function(){ var sound = new Audio('loop.mp3'); sound.volume = 0.9; sound.addEventListener('ended', function() { // loop sound this.currentTime = 0.1; this.play(); }, false); sound.play(); })(); // ]]></script> |
Шаг 2. 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 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
</p> / * Virtual DJ * / .vdj { margin: 100px auto 0; position: relative; width: 800px; } / * Винил ключевых кадров * / @-webkit-keyframes vinyl { 0% { -moz-transform: rotate(0deg); -webkit-transform: rotate(0deg); } 100% { -moz-transform: rotate(360deg); -webkit-transform: rotate(360deg); } } @-moz-keyframes vinyl { 0% { -moz-transform: rotate(0deg); -webkit-transform: rotate(0deg); } 100% { -moz-transform: rotate(360deg); -webkit-transform: rotate(360deg); } } .v1, .v2, .v3, .v4 { / * CSS3 анимация * / -moz-animation-name: vinyl; -moz-animation-duration: 3s; -moz-animation-timing-function: linear; -moz-animation-iteration-count: infinite; -moz-animation-direction: normal; -moz-animation-delay: 0; -moz-animation-play-state: running; -moz-animation-fill-mode: forwards; -webkit-animation-name: vinyl; -webkit-animation-duration: 3s; -webkit-animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; -webkit-animation-delay: 0; -webkit-animation-play-state: running; -webkit-animation-fill-mode: forwards; } .v1 { left: 83px; position: absolute; top: 77px; } .v2 { left: 580px; position: absolute; top: 77px; } .v3 { left: 66px; position: absolute; top: 382px; } .v4 { left: 634px; position: absolute; top: 382px; } / * Ключевые кадры speaker */ @-webkit-keyframes speaker { 0% { -moz-transform: scale(0.75); -webkit-transform: scale(0.75); } 45% { -moz-transform: scale(0.85); -webkit-transform: scale(0.85); } 100% { -moz-transform: scale(0.75); -webkit-transform: scale(0.75); } } @-moz-keyframes speaker { 0% { -moz-transform: scale(0.75); -webkit-transform: scale(0.75); } 45% { -moz-transform: scale(0.85); -webkit-transform: scale(0.85); } 100% { -moz-transform: scale(0.75); -webkit-transform: scale(0.75); } } .si1, .si2, .si3, .si4 { / * CSS3 анимация задержки * / -webkit-transform:scale(0.75); -moz-transform:scale(0.75); -ms-transform:scale(0.75); -o-transform:scale(0.75); transform:scale(0.75); -moz-animation-name: speaker; -moz-animation-duration: 0.5s; -moz-animation-timing-function: linear; -moz-animation-iteration-count: infinite; -moz-animation-direction: normal; -moz-animation-delay: 0; -moz-animation-play-state: running; -moz-animation-fill-mode: forwards; -webkit-animation-name: speaker; -webkit-animation-duration: 0.5s; -webkit-animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; -webkit-animation-delay: 0; -webkit-animation-play-state: running; -webkit-animation-fill-mode: forwards; } .si1 { left: 541px; position: absolute; top: 249px; } .s1 { left: 545px; position: absolute; top: 253px; } .si2 { left: 606px; position: absolute; top: 249px; / * CSS3 анимация задержки * / -moz-animation-delay: 0.25s; -webkit-animation-delay: 0.25s; } .s2 { left: 610px; position: absolute; top: 253px; } .si3 { left: 671px; position: absolute; top: 249px; } .s3 { left: 675px; position: absolute; top: 253px; } .si4 { left: 735px; position: absolute; top: 249px; / * CSS3 анимация задержки * / -moz-animation-delay: 0.25s; -webkit-animation-delay: 0.25s; } .s4 { left: 739px; position: absolute; top: 253px; } / *Ключевые кадры * / @-webkit-keyframes slider { 0% { margin-top:0px; } 50% { margin-top:90px; } 100% { margin-top:0px; } } @-moz-keyframes slider { 0% { margin-top:0px; } 50% { margin-top:90px; } 100% { margin-top:0px; } } .slid1, .slid2 { / * CSS3 анимация * / -moz-animation-name: slider; -moz-animation-duration: 2.0s; -moz-animation-timing-function: linear; -moz-animation-iteration-count: infinite; -moz-animation-direction: normal; -moz-animation-delay: 0; -moz-animation-play-state: running; -moz-animation-fill-mode: forwards; -webkit-animation-name: slider; -webkit-animation-duration: 2.0s; -webkit-animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; -webkit-animation-delay: 0; -webkit-animation-play-state: running; -webkit-animation-fill-mode: forwards; } .slid1 { left: 254px; position: absolute; top: 94px; } .slid2 { left: 751px; position: absolute; top: 94px; /* css3 анимация delay */ -moz-animation-delay: -1.0s; -webkit-animation-delay: -1.0s; } /* Кнопки*/ @-webkit-keyframes buttons { 0% { opacity: 1; } 45% { opacity: 0; } 100% { opacity: 1; } } @-moz-keyframes buttons { 0% { opacity: 1; } 45% { opacity: 0; } 100% { opacity: 1; } } .b1, .b2, .b3, .b4, .b5, .b6 { / * CSS3 анимация * / -moz-animation-name: buttons; -moz-animation-duration: 1.0s; -moz-animation-timing-function: linear; -moz-animation-iteration-count: infinite; -moz-animation-direction: normal; -moz-animation-delay: 0; -moz-animation-play-state: running; -moz-animation-fill-mode: forwards; -webkit-animation-name: buttons; -webkit-animation-duration: 1.0s; -webkit-animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; -webkit-animation-delay: 0; -webkit-animation-play-state: running; -webkit-animation-fill-mode: forwards; } .b1 { left: 17px; position: absolute; top: 105px; } .b2 { left: 17px; position: absolute; top: 147px; -moz-animation-delay: 0.3s; -webkit-animation-delay: 0.3s; } .b3 { left: 17px; position: absolute; top: 190px; -moz-animation-delay: 0.6s; -webkit-animation-delay: 0.6s; } .b4 { left: 513px; position: absolute; top: 105px; -moz-animation-delay: 0.3s; -webkit-animation-delay: 0.3s; } .b5 { left: 513px; position: absolute; top: 147px; -moz-animation-delay: 0.6s; -webkit-animation-delay: 0.6s; } .b6 { left: 513px; position: absolute; top: 190px; } @-webkit-keyframes eq { 0% { background-position: 0 0; } 100% { background-position: 0 -92px; } } @-moz-keyframes eq { 0% { background-position: 0 0; } 100% { background-position: 0 -92px; } } .eq { background: url("../images/eq.png") no-repeat scroll center top transparent; height: 92px; left: 197px; position: absolute; top: 389px; width: 18px; /* css3 Анимация */ -moz-animation-name: eq; -moz-animation-duration: 2.0s; -moz-animation-timing-function: linear; -moz-animation-iteration-count: infinite; -moz-animation-direction: normal; -moz-animation-delay: 0; -moz-animation-play-state: running; -moz-animation-fill-mode: forwards; -webkit-animation-name: eq; -webkit-animation-duration: 2.0s; -webkit-animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; -webkit-animation-delay: 0; -webkit-animation-play-state: running; -webkit-animation-fill-mode: forwards; } @-webkit-keyframes eq2 { 0% { background-position: 0 0; } 100% { background-position: -260px 0; } } @-moz-keyframes eq2 { 0% { background-position: 0 0; } 100% { background-position: -260px 0; } } .eq2 { background: url("../images/eq2.png") no-repeat scroll center top transparent; height: 28px; left: 271px; position: absolute; top: 240px; width: 260px; /* css3 Анимация */ -moz-animation-name: eq2; -moz-animation-duration: 6.0s; -moz-animation-timing-function: linear; -moz-animation-iteration-count: infinite; -moz-animation-direction: normal; -moz-animation-delay: 0; -moz-animation-play-state: running; -moz-animation-fill-mode: forwards; -webkit-animation-name: eq2; -webkit-animation-duration: 6.0s; -webkit-animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; -webkit-animation-delay: 0; -webkit-animation-play-state: running; -webkit-animation-fill-mode: forwards; } |
Материал взят из зарубежного источника. И представлен исключительно в ознакомительных целях. Музыка в плеере- Totally Enormous Extinct Dinosaurs – Garden.
Читайте также:
Опубликовал Cooper 22.05.2012 в 12:41, в категории CSS. Вы можете следить за комментариями через RSS 2.0. Вы можете перейти в конец записи и оставить комментарий. Пинги запрещены. |