Last active
June 18, 2022 10:01
-
-
Save kobitoDevelopment/c8f84be13d97e738c88e9c4f158b1575 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
| <div class="remap"></div> |
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 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 // 指定したい秒数を記述 | |
| ); |
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
| .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