mirror of
https://github.com/DavidHDev/vue-bits.git
synced 2026-03-07 14:39:30 -07:00
Animation feature build fix: Ensuring strict type declaration to avoid build errors
This commit is contained in:
@@ -78,9 +78,11 @@ const setupAnimation = () => {
|
|||||||
if (spinTl.value) {
|
if (spinTl.value) {
|
||||||
spinTl.value.kill();
|
spinTl.value.kill();
|
||||||
}
|
}
|
||||||
spinTl.value = gsap
|
spinTl.value = gsap.timeline({ repeat: -1 }).to(cursor, {
|
||||||
.timeline({ repeat: -1 })
|
rotation: '+=360',
|
||||||
.to(cursor, { rotation: '+=360', duration: props.spinDuration, ease: 'none' });
|
duration: props.spinDuration,
|
||||||
|
ease: 'none'
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
createSpinTimeline();
|
createSpinTimeline();
|
||||||
@@ -173,11 +175,13 @@ const setupAnimation = () => {
|
|||||||
const offsets = [tlOffset, trOffset, brOffset, blOffset];
|
const offsets = [tlOffset, trOffset, brOffset, blOffset];
|
||||||
|
|
||||||
corners.forEach((corner, index) => {
|
corners.forEach((corner, index) => {
|
||||||
|
const offset = offsets[index];
|
||||||
|
if (!offset) return;
|
||||||
tl.to(
|
tl.to(
|
||||||
corner as HTMLElement,
|
corner as HTMLElement,
|
||||||
{
|
{
|
||||||
x: offsets[index].x,
|
x: offset.x,
|
||||||
y: offsets[index].y,
|
y: offset.y,
|
||||||
duration: 0.2,
|
duration: 0.2,
|
||||||
ease: 'power2.out'
|
ease: 'power2.out'
|
||||||
},
|
},
|
||||||
@@ -221,11 +225,13 @@ const setupAnimation = () => {
|
|||||||
|
|
||||||
const tl = gsap.timeline();
|
const tl = gsap.timeline();
|
||||||
corners.forEach((corner, index) => {
|
corners.forEach((corner, index) => {
|
||||||
|
const pos = positions[index];
|
||||||
|
if (!pos) return;
|
||||||
tl.to(
|
tl.to(
|
||||||
corner as HTMLElement,
|
corner as HTMLElement,
|
||||||
{
|
{
|
||||||
x: positions[index].x,
|
x: pos.x,
|
||||||
y: positions[index].y,
|
y: pos.y,
|
||||||
duration: 0.3,
|
duration: 0.3,
|
||||||
ease: 'power3.out'
|
ease: 'power3.out'
|
||||||
},
|
},
|
||||||
@@ -240,9 +246,11 @@ const setupAnimation = () => {
|
|||||||
const normalizedRotation = currentRotation % 360;
|
const normalizedRotation = currentRotation % 360;
|
||||||
|
|
||||||
spinTl.value.kill();
|
spinTl.value.kill();
|
||||||
spinTl.value = gsap
|
spinTl.value = gsap.timeline({ repeat: -1 }).to(cursorRef.value, {
|
||||||
.timeline({ repeat: -1 })
|
rotation: '+=360',
|
||||||
.to(cursorRef.value, { rotation: '+=360', duration: props.spinDuration, ease: 'none' });
|
duration: props.spinDuration,
|
||||||
|
ease: 'none'
|
||||||
|
});
|
||||||
|
|
||||||
gsap.to(cursorRef.value, {
|
gsap.to(cursorRef.value, {
|
||||||
rotation: normalizedRotation + 360,
|
rotation: normalizedRotation + 360,
|
||||||
@@ -329,9 +337,11 @@ watch(
|
|||||||
|
|
||||||
if (spinTl.value.isActive()) {
|
if (spinTl.value.isActive()) {
|
||||||
spinTl.value.kill();
|
spinTl.value.kill();
|
||||||
spinTl.value = gsap
|
spinTl.value = gsap.timeline({ repeat: -1 }).to(cursorRef.value, {
|
||||||
.timeline({ repeat: -1 })
|
rotation: '+=360',
|
||||||
.to(cursorRef.value, { rotation: '+=360', duration: props.spinDuration, ease: 'none' });
|
duration: props.spinDuration,
|
||||||
|
ease: 'none'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
|||||||
Reference in New Issue
Block a user