-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from LittleFoxCompany/update-animation-module
Add a module for the animateText function
- Loading branch information
Showing
5 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
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,13 @@ | ||
.animate-fade-in-up { | ||
@apply relative translate-y-full opacity-0; | ||
animation: fadeUp 1.5s cubic-bezier(0.2, 0.6, 0.3, 1) forwards; | ||
|
||
@keyframes fadeUp { | ||
100% { | ||
opacity: 1; | ||
transform: translateY(0%); | ||
} | ||
} | ||
} | ||
|
||
|
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
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,43 @@ | ||
<template> | ||
<Example class="flex"> | ||
<ExampleInputs class="flex flex-col"> | ||
<div class="flex gap-4"> | ||
<FormInput v-model="value" label="Title" /> | ||
<FormSelect v-model="splitBy" label="Select" name="select" placeholder="Select an option"> | ||
<option value="word">Word</option> | ||
<option value="character">Character</option> | ||
</FormSelect> | ||
</div> | ||
<div class="flex gap-4"> | ||
<FormInput v-model="time" label="Time" type="number" name="time" value="100" placeholder="Time" /> | ||
<FormSelect v-model="unit" label="Unit" name="unit" placeholder="Select an option"> | ||
<option value="ms">ms</option> | ||
<option value="s">s</option> | ||
</FormSelect> | ||
</div> | ||
<FormInput v-model="className" label="Classes" type="text" name="classes" placeholder="Classes" /> | ||
</ExampleInputs> | ||
<ExampleResult> | ||
<h1 :key="animationKey" v-html="animated" class="text-balance text-center font-bold leading-[1.25em] text-4xl text-gray-900 dark:text-white"></h1> | ||
</ExampleResult> | ||
</Example> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, computed, watch } from 'vue'; | ||
const value = ref('Zippy little utils for your JavaScript projects.'); | ||
const splitBy = ref('word'); | ||
const time = ref(100); | ||
const unit = ref('ms'); | ||
const className = ref('animate-fade-in-up'); | ||
const animationKey = ref(0); | ||
const animated = computed(() => { | ||
return animateText(value.value, { splitBy: splitBy.value, time: time.value, unit: unit.value, class: className.value }); | ||
}); | ||
watch([value, splitBy, time, unit, className], () => { | ||
animationKey.value += 1; | ||
}); | ||
</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
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