Skip to content

Instantly share code, notes, and snippets.

@redknitin
Created August 21, 2018 14:16
Show Gist options
  • Save redknitin/98ecbbf25ba84787f4e8736525e26f3e to your computer and use it in GitHub Desktop.
Save redknitin/98ecbbf25ba84787f4e8736525e26f3e to your computer and use it in GitHub Desktop.
CSS Animation - Translation and Opacity
<!doctype html><html>
<head>
<title></title>
<style>
body {
background-color: black;
}
@keyframes wiggum {
0% { transform: translateX(0px); }
25% { transform: translateY(400px); opacity: 0.05; }
100% { transform: translateY(400px) translateX(800px); }
}
#a1 {
margin-left: 0px;
animation: wiggum 10s linear 1s infinite alternate;
}
@keyframes example {
from {background-color: red;}
to {background-color: blue;}
}
/* The element to apply the animation to */
div {
width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}
</style>
<script></script>
</head>
<body>
<div id="a1">
...
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment