-
-
Save alexanderadam/76a1676b9e58842a6b2c to your computer and use it in GitHub Desktop.
YouTubesque morphing button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* YouTubesque morphing button | |
* Requires clip-path with CSS Shapes support, not just url() | |
* http://caniuse.com/#feat=css-clip-path | |
*/ | |
@keyframes play { to { | |
-webkit-clip-path: polygon(0 0, 100% 50%, 100% 50%, 0 100%); | |
clip-path: polygon(0 0, 100% 50%, 100% 50%, 0 100%); | |
/* it should be 50% 100% (one value), but Chrome & Safari are buggy (in different ways), hence the 51 & the duplication */ | |
background-size: 51% 100%, 51% 100%; | |
} } | |
button { | |
border: 0; | |
width: 1em; | |
height: 1em; | |
background: linear-gradient(currentColor, currentColor) left, | |
linear-gradient(currentColor, currentColor) right; | |
background-size: 42% 100%; /* Set pause bar width here */ | |
background-repeat: no-repeat; | |
-webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); | |
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); | |
animation: play .6s infinite alternate ease-in-out; | |
font-size: 500%; | |
color: black; /* Change color here, in one place */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button></button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","fontsize":"80","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment