Skip to content

Commit

Permalink
Introduce the raw object GSAP animation
Browse files Browse the repository at this point in the history
  • Loading branch information
LSViana committed Jan 10, 2024
1 parent ad4008d commit e10970b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div class="flex flex-col gap-3">
<p>Value: <code>{{ source.value }}</code></p>
<div class="h-2 w-64 overflow-hidden rounded-full bg-slate-500">
<div class="h-full bg-slate-400" :style="{ width: `${source.value}%` }" />
</div>
<a href="#" class="underline" @click.prevent="listeners.onRestart">Restart</a>
</div>
</template>

<script setup lang="ts">
import gsap from 'gsap'
import { onMounted, reactive } from 'vue'
const source = reactive({ value: 0 })
const methods = {
animate(): void {
gsap.set(source, { value: 0 })
gsap.to(
source,
{
value: 100,
duration: 2
})
}
}
const listeners = {
onRestart(): void {
methods.animate()
}
}
onMounted(methods.animate)
</script>
5 changes: 5 additions & 0 deletions pages/experiments/micro-interactions/gsap/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<ExperimentCanvas>
<WlGsapStaggeredAnimation />
</ExperimentCanvas>
<p>A raw object animation example:</p>
<ExperimentCanvas>
<WlGsapRawObjectAnimationVue />
</ExperimentCanvas>
</Container>
</NuxtLayout>
</template>
Expand All @@ -18,4 +22,5 @@ import Container from '~/components/shared/layout/Container.vue'
import ExperimentCanvas from '~/components/shared/experiments/ExperimentCanvas.vue'
import WlGsapSimpleAnimation from '~/components/experiments/micro-interactions/gsap/WlGsapSimpleAnimation.vue'
import WlGsapStaggeredAnimation from '~/components/experiments/micro-interactions/gsap/WlGsapStaggeredAnimation.vue'
import WlGsapRawObjectAnimationVue from '~/components/experiments/micro-interactions/gsap/WlGsapRawObjectAnimation.vue'
</script>

1 comment on commit e10970b

@vercel
Copy link

@vercel vercel bot commented on e10970b Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web-labs – ./

web-labs-git-main-lsviana.vercel.app
web-labs-lsviana.vercel.app
web-labs.vercel.app

Please sign in to comment.