Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix animation wrong #6

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@tailwind utilities;

.slide-enter-active, .slide-leave-active {
transition: all .5s ease-in-out;
transition: all 1.5s ease-in-out;
}

.slide-enter-from,
Expand Down
28 changes: 14 additions & 14 deletions pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<html lang="zh-CN"></html>
<div class="py-10 px-7">
<content-doc v-slot="{doc}">
<transition-group name="slide" @enter="onEnter">
<div v-if="finish" class="text-center mb-4 dark:prose-invert dark:prose-headings:text-gray-300">
<transition-group name="slide" @enter="onEnter" :css="false">
<div v-if="finish" class="transition-all duration-1000 text-center mb-4 dark:prose-invert dark:prose-headings:text-gray-300" data-delay="0.5">
<img alt="Rescue Me" class="mx-auto"
src="/logo.svg" style="max-width: 90%">
<br/>
<hr class="mx-auto" style="width: 90%; border: 1px solid #1f2937; border-radius: 5px;">
</div>
<content-renderer v-if="finish" key="renderer" :value="doc" class="
transition-all duration-1000
dark:prose-invert
prose-p:text-gray-700 dark:prose-p:text-gray-300
dark:prose-headings:text-gray-200
prose prose-img:border prose-img:border-solid prose-img:border-gray-200
dark:prose-img:border-gray-700
prose-img:rounded-md max-w-full mx-auto" data-delay="2"/>
prose-img:rounded-md max-w-full mx-auto" data-delay="0.8"/>
<footer v-if="finish"
key="footer"
class="w-full mt-4 text-right opacity-50 text-gray-600 font-sans text-sm dark:text-gray-100"
data-delay="2">
class="transition-all w-full mt-4 text-right opacity-50 text-gray-600 font-sans text-sm dark:text-gray-100">
<a v-for="([author], idx) in doc['authors']"
class="underline-offset-4">
{{ author }} {{ idx === doc['authors'].length - 1 ? '' : ', ' }}
Expand Down Expand Up @@ -76,17 +76,17 @@
<script lang="ts" setup>
const finish = ref(false);
setTimeout(() => finish.value = true, 100)
let depth = 20;
const onEnter = (el: Element, done: () => void) => {
if (depth >= 0) {
const delay = Number((el as HTMLElement).dataset.delay ?? 0) * 1000;
setTimeout(() => {
done();
}, delay);
depth -= 1;
} else {
const delay = Number((el as HTMLElement).dataset.delay ?? 0) * 1000;
const element = el as HTMLElement;
element.style.opacity = '0';
element.style.transform = 'translateY(-20px)';
setTimeout(() => {
console.log(el, 'done')
element.style.opacity = '1';
element.style.transform = 'translateY(0px)';
done();
}
}, delay);
}
const stargazers_count = ref(0);
const commit = ref('');
Expand Down