Анимированная кнопочка Твиттера на CSS3 и CSG
Неплохая анимированная кнопочка Твиттера для вашего сайта. При наведении кнопочка открывается и можно перейти по указанной ссылке
Для начала посмотрите ДЕМО
Установка:
1#: В самый низ вашего 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 |
section, section div { /* See it in slo-mo, you can change this */ transition-duration: .6s; } section, .button { transition-timing-function: ease; } section { display: inline-block; position: relative; padding: .375rem .375rem 0; height: 2.5rem; background: #A9ADB6; border-radius: .25rem; perspective: 300; box-shadow: 0 -1px 2px #fff, inset 0 1px 2px rgba(0,0,0,.2), inset 0 .25rem 1rem rgba(0,0,0,.1); } .button { opacity: 0; } .cover { position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform-origin: center bottom; transform-style: preserve-3d; font: 1.25em/2 "icon"; color: white; text-align: center; pointer-events: none; z-index: 100; } .innie, .outie, .spine, .shadow { position: absolute; width: 100%; } .innie, .outie { height: 100%; background-image: -webkit-linear-gradient(top, transparent 0%, rgba(0,0,0,.1) 100%); border-radius: .25rem; } svg { width: 40px; height: 40px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)) } .innie { background-color: #67E2FE; text-shadow: 0 -2px 4px rgba(0,0,0,.2); } .spine { top: .25rem; background: #20C7F3; height: .25rem; transform: rotateX(90deg); transform-origin: center top; } .shadow { top: 100%; left: 0; height: 3.5rem; transform-origin: center top; transform: rotateX(90deg); opacity: 0; z-index: 0; background-image: -webkit-linear-gradient(top, rgba(0,0,0,.6) 0%, transparent 100%); background-image: linear-gradient(to bottom, rgba(0,0,0,.6) 0%, transparent 100%); border-radius: .4rem; } .outie { background-color: #2EC8FA; transform: translateZ(.25rem); text-shadow: 0 2px 4px rgba(0,0,0,.2); } section:hover { background: #EBEFF2; } section:hover .button { opacity: 1; } section:hover .cover, section:hover .innie, section:hover .spine, section:hover .outie, section:hover .spine { transition-timing-function: cubic-bezier(.2,.7,.1,1.1); } section:hover .cover { transform: rotateX(-120deg); } section:hover .innie { background-color: #3ADAFC; } section:hover .spine { background-color: #52B1E0; } section:hover .outie { background-color: #2174A0; color: rgba(255,255,255,0); } section:hover .shadow { opacity: 1; transform: rotateX(45deg) scale(.95); } .twitter-follow-button { display: block; border-radius: 4px; padding: 5px; position: relative; background-color: #1b95e0; color: #fff; font-weight: 500; cursor: pointer; text-decoration: none; } |
2#: В то место, где должна быть кнопочка, вставьте:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<section> <div class="button"> <a href="#" class="twitter-follow-button">Следовать за @username</a> </div> <div class="cover"> <div class="innie"> <svg class="twitter-logo" height="10" viewBox="0 0 400 400" width="10" xmlns="http://www.w3.org/2000/svg"><path fill="white" d="M153.6 301.6c94.3 0 145.9-78.2 145.9-145.9 0-2.2 0-4.4-.1-6.6 10-7.2 18.7-16.3 25.6-26.6-9.2 4.1-19.1 6.8-29.5 8.1 10.6-6.3 18.7-16.4 22.6-28.4-9.9 5.9-20.9 10.1-32.6 12.4-9.4-10-22.7-16.2-37.4-16.2-28.3 0-51.3 23-51.3 51.3 0 4 .5 7.9 1.3 11.7-42.6-2.1-80.4-22.6-105.7-53.6-4.4 7.6-6.9 16.4-6.9 25.8 0 17.8 9.1 33.5 22.8 42.7-8.4-.3-16.3-2.6-23.2-6.4v.7c0 24.8 17.7 45.6 41.1 50.3-4.3 1.2-8.8 1.8-13.5 1.8-3.3 0-6.5-.3-9.6-.9 6.5 20.4 25.5 35.2 47.9 35.6-17.6 13.8-39.7 22-63.7 22-4.1 0-8.2-.2-12.2-.7 22.6 14.4 49.6 22.9 78.5 22.9"></path></svg> </div> <div class="spine"></div> <div class="outie"> <svg class="twitter-logo" height="10" viewBox="0 0 400 400" width="10" xmlns="http://www.w3.org/2000/svg"><path fill="white" d="M153.6 301.6c94.3 0 145.9-78.2 145.9-145.9 0-2.2 0-4.4-.1-6.6 10-7.2 18.7-16.3 25.6-26.6-9.2 4.1-19.1 6.8-29.5 8.1 10.6-6.3 18.7-16.4 22.6-28.4-9.9 5.9-20.9 10.1-32.6 12.4-9.4-10-22.7-16.2-37.4-16.2-28.3 0-51.3 23-51.3 51.3 0 4 .5 7.9 1.3 11.7-42.6-2.1-80.4-22.6-105.7-53.6-4.4 7.6-6.9 16.4-6.9 25.8 0 17.8 9.1 33.5 22.8 42.7-8.4-.3-16.3-2.6-23.2-6.4v.7c0 24.8 17.7 45.6 41.1 50.3-4.3 1.2-8.8 1.8-13.5 1.8-3.3 0-6.5-.3-9.6-.9 6.5 20.4 25.5 35.2 47.9 35.6-17.6 13.8-39.7 22-63.7 22-4.1 0-8.2-.2-12.2-.7 22.6 14.4 49.6 22.9 78.5 22.9"></path></svg> </div> </div> <div class="shadow"></div> </section> |