Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Last active June 18, 2022 10:01
Show Gist options
  • Select an option

  • Save kobitoDevelopment/c8f84be13d97e738c88e9c4f158b1575 to your computer and use it in GitHub Desktop.

Select an option

Save kobitoDevelopment/c8f84be13d97e738c88e9c4f158b1575 to your computer and use it in GitHub Desktop.
<div class="remap"></div>
// タイムラインを作成
const tl = gsap.timeline({ repeat: -1 }); // 繰り返し回数を設定 -1で無限
// タイムラインにアニメーション内容を追加
tl.add(gsap.to(".remap", 2.0, { x: 800, rotate: 360 }));
// タイムラインの0.25秒の地点まで到達したら
tl.call(
function () {
// .timeScale()でアニメーション速度を、本来のスピードを1として乗算指定可能
tl.timeScale(0.1);
},
null, // 引数なしの場合はnull
0.25 // 指定したい秒数を記述
);
// タイムラインの0.50秒の地点まで到達したら
tl.call(
function () {
// .timeScale()でアニメーション速度を、本来のスピードを1として乗算指定可能
tl.timeScale(1.0);
},
null, // 引数なしの場合はnull
0.5 // 指定したい秒数を記述
);
.remap {
width: 200px;
height: 200px;
border: 2px solid green;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment