Examples

Here you'll find some use-cases and examples.
See it in action

Entrance

See reference

Basic fade-in from left

<div v-gsap.whenVisible.from="{ opacity: 0, x: -32 }"></div>

Custom start / end

<div
  v-gsap.whenVisible.from="{
    opacity: 0,
    start: 'top 50%',
    end: 'bottom 50%',
  }"
></div>

Entrance only single time

<div v-gsap.whenVisible.once.from="{ opacity: 0, x: -32 }"></div>

With .entrance

<div v-gsap.entrance.slide-left></div>
There are multiple presets for entrace See details

Debug with markers

<div v-gsap.markers.whenVisible.from="{ opacity: 0, x: -32 }"></div>

Magnetic

See reference

Basic

<button v-gsap.magnetic></button>

Strong

<button v-gsap.magnetic.strong></button>

Stagger

See reference

<ul v-gsap.whenVisible.stagger>
  <li>Option 1</li>
  <li>Option 2</li>
  <li>Option 3</li>
</ul>

Animate Text

See reference

Using textContent

<div v-gsap.whenVisible.animateText>Lorem Ipsum...</div>

Using value

<div v-gsap.whenVisible.animateText="'Lorem Ipsum...'"></div>

slow / fast

<div v-gsap.whenVisible.animateText.slow>Lorem Ipsum...</div>

Parallax

See reference

Slower

<div v-gsap.parallax.slower>Lorem Ipsum...</div>

Faster with custom speed

<div v-gsap.parallax.faster-5>Lorem Ipsum...</div>

Hover

See reference

Basic

<div v-gsap.whileHover.to="{ scale: 1.1 }"></div>

No reverse

<div v-gsap.whileHover.noReverse.to="{ scale: 1.1 }"></div>

Differing Mobile / Desktop

See reference

Desktop only

<div v-gsap.desktop.infinitely.to="{ rotate: '90deg' }"></div>

Desktop + Mobile differing

<div
  v-gsap.desktop.infinitely.to="{ rotate: '90deg' }"
  v-gsap.mobile.infinitely.to="{ rotate: '-90deg' }"
></div>

Draggable

See reference

Basic (within parent)

<div v-gsap.draggable></div>

Basic (whole body)

<div v-gsap.draggable.bounds="'body'"></div>

Horizontal only

<div v-gsap.draggable.x></div>

Vertical only (within body)

<div v-gsap.draggable.y.bounds="'body'"></div>

Rotation

<div v-gsap.draggable.rotation></div>