Last active
May 27, 2022 02:14
-
-
Save kobitoDevelopment/0080317826fd2c3d0d7042f9c9cb78d4 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
<p class="hoge">テスト</p> | |
<p class="fuga">アニメーション開始</p> | |
<p class="piyo">アニメーション終了</p> |
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
const hoge = document.querySelector(".hoge"); | |
const fuga = document.querySelector(".fuga"); | |
const piyo = document.querySelector(".piyo"); | |
hoge.classList.add("is-active"); | |
hoge.addEventListener("animationstart", function () { | |
fuga.classList.add("is-active"); | |
}); | |
hoge.addEventListener("animationend", function () { | |
piyo.classList.add("is-active"); | |
}); |
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
.hoge { | |
color: black; | |
&.is-active { | |
animation: check 2s 1s forwards; | |
} | |
} | |
.fuga { | |
color: black; | |
&.is-active { | |
color: blue; | |
} | |
} | |
.piyo { | |
color: black; | |
&.is-active { | |
color: green; | |
} | |
} | |
@keyframes check { | |
0% { | |
color: black; | |
} | |
50% { | |
color: yellow; | |
} | |
100% { | |
color: red; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment