Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Last active May 27, 2022 02:14
Show Gist options
  • Save kobitoDevelopment/0080317826fd2c3d0d7042f9c9cb78d4 to your computer and use it in GitHub Desktop.
Save kobitoDevelopment/0080317826fd2c3d0d7042f9c9cb78d4 to your computer and use it in GitHub Desktop.
<p class="hoge">テスト</p>
<p class="fuga">アニメーション開始</p>
<p class="piyo">アニメーション終了</p>
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");
});
.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