-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce the raw object GSAP animation
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
components/experiments/micro-interactions/gsap/WlGsapRawObjectAnimation.vue
This file contains 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
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> |
This file contains 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
e10970b
There was a problem hiding this comment.
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