Skip to content

Commit

Permalink
Add page and layout transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
lskellerm committed Mar 8, 2024
1 parent 7dac3dc commit f80c943
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
26 changes: 26 additions & 0 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,29 @@ useHead({
}
});
</script>

<style>
.page-slide-enter-active {
transition: all 0.3s ease-out;
}
.page-slide-leave-active {
transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
}
.page-slide-enter-from,
.page-slide-leave-to {
transform: translateX(20px);
opacity: 0;
}
.layout-fade-enter-active,
.layout-fade-leave-active {
transition: all 0.4s;
}
.layout-fade-enter-from,
.layout-fade-leave-to {
opacity: 0;
filter: blur(1rem);
}
</style>
10 changes: 10 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ export default defineNuxtConfig({
'@nuxtjs/turnstile',
'nuxt-rate-limit'
],
app: {
pageTransition: {
name: 'page-slide',
mode: 'out-in'
},
layoutTransition: {
name: 'layout-fade',
mode: 'out-in'
}
},
turnstile: {
siteKey: '0x4AAAAAAAS0Q9wK8FOqKxCF'
},
Expand Down
5 changes: 4 additions & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
</template>
<script setup lang="ts">
definePageMeta({
layout: false
layout: false,
layoutTransition: {
name: 'layout-fade'
}
});
useServerSeoMeta({
Expand Down

0 comments on commit f80c943

Please sign in to comment.