Skip to content

Instantly share code, notes, and snippets.

@mndvns
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save mndvns/b12a4bc080592a532b60 to your computer and use it in GitHub Desktop.

Select an option

Save mndvns/b12a4bc080592a532b60 to your computer and use it in GitHub Desktop.
Composable animations with ESS
@-webkit-keyframes thing {
html 0% {
opacity: 0
}
html 0% {
background: black;
}
html 100% {
opacity: 1
}
html 100% {
background: white;
}
}
@keyframes thing {
html 0% {
opacity: 0
}
html 0% {
background: black;
}
html 100% {
opacity: 1
}
html 100% {
background: white;
}
}
// a clean and composable interface
html
FadeIn
block start
background black
block end
background white
// a fading animation with hooks
function FadeIn(opts)
Keyframe(name='thing')
0%
opacity 0
= opts.start
100%
opacity 1
= opts.end
// vendor-prefixed constructor
function Keyframe(opts)
`'@-webkit-keyframes ' + opts.name`
= opts.children
`'@keyframes ' + opts.name`
= opts.children
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment