728x90
๋ฐ์ํ
GSAP
์น ๋ธ๋ผ์ฐ์ ์์ ํ์ํ ์ ๋๋ฉ์ด์ ์ ๊ตฌํํ๊ธฐ ์ํ ์๋ฐ์คํฌ๋ฆฝํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค. ๊ธฐ์กด์ CSS ์ ๋๋ฉ์ด์ ๊ณผ JavsScript ์ ๋๋ฉ์ด์ ๋ณด๋ค ์ฌ์ฉ์ฑ์ด ํธํ๊ณ , ํ์ํ ํผํฌ๋จผ์ค๊ฐ ๋๋ณด์ด๋ ์ ๋๋ฉ์ด์ ์ ์ฉ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค.
์ฌ์ฉ๋ฒ
๊ธฐ์กด์ style์ด๋ js ๋งํฌ์ฒ๋ผ GSAP์์ script ๋งํฌ๋ฅผ ๊ฐ์ ธ์, ์ ๋๋ฉ์ด์ ์ ์ฝ๊ฒ ์ ์ฉํ ์ ์๊ฒ ๋ง๋ค์ด์ค๋๋ค.
์์
GSAP ์์ค
<!-- GSAP -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.0/gsap.min.js"></script>
<script>
const slider = document.querySelectorAll(".slider");
let currentIndex = 0;
setInterval(() => {
currentIndex = (currentIndex + 1) % slider.length;
gsap.to(".slider__inner",{
duration : 0.6,
x : -800 * currentIndex,
});
}, 2000);
</script>
728x90
๋ฐ์ํ
'์๋ฐ์คํฌ๋ฆฝํธ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
JQuery ๊ธฐ๋ณธ ์ ํ์ (4) | 2022.08.30 |
---|---|
JQuery๋? (5) | 2022.08.30 |
ํจ์ ์ดํดํ๊ธฐ 2 (5) | 2022.08.22 |
charAt() (7) | 2022.08.22 |
match() (6) | 2022.08.22 |
๋๊ธ