Created
July 28, 2022 20:09
-
-
Save Maxondria/52fbcded85333d5f0b3d197d4dc44d86 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
</head> | |
<style> | |
.parent { | |
width: 400px; | |
height: 400px; | |
background-color: hsla(200, 100%, 20%); | |
} | |
.child { | |
width: 50%; | |
height: 50%; | |
background-color: red; | |
/* transition: transform 1s cubic-bezier(0.9, -1.74, 0.19, 2.59); */ | |
animation: left-to-right 3s ease-in forwards infinite alternate; | |
} | |
.parent:hover .child { | |
/* animation: left-to-right 3s ease-in forwards infinite alternate; */ | |
animation-play-state: paused; | |
} | |
@keyframes left-to-right { | |
0% { | |
background-color: red; | |
transform: translateX(0); | |
} | |
33% { | |
background-color: blue; | |
transform: translateY(100%); | |
} | |
66% { | |
background-color: green; | |
transform: translateX(100%) translateY(100%); | |
} | |
100% { | |
background-color: pink; | |
transform: translateX(100%); | |
} | |
} | |
</style> | |
<body> | |
<div class="parent"> | |
<div class="child"></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment