一键导入
gsap-animations
GSAP + ScrollTrigger - animateInOnEnter, getMainScroller, useGsapAnimations. Use when adding enter/scroll animations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
GSAP + ScrollTrigger - animateInOnEnter, getMainScroller, useGsapAnimations. Use when adding enter/scroll animations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Global Pinia store (useAppStore) for theme and language with cookie persistence. Use when changing theme or language, or touching app/stores/app.ts.
Create/edit blog articles in EN/ES - frontmatter, collections, images, Markdown features. Use when writing content under content/{en,es}/blog/.
Auto-imported global and content components plus layouts (default/blog). Use when using/creating components or working with ContentRenderer.
Project composables - useBlog, usePageSeo, useEnterAnimations, useBlogScroll, useGsapAnimations. Use when consuming blog/SEO/animation logic.
CSS custom properties, utility classes and theme colors. Use when editing styles, working in app/assets/styles/*, writing <style scoped>, or touching colors, spacing or typography.
Static data - contact.ts, projects.ts, sidebar-items.ts. Use when displaying contact/projects info or adding navigation items.
| name | gsap-animations |
| description | GSAP + ScrollTrigger - animateInOnEnter, getMainScroller, useGsapAnimations. Use when adding enter/scroll animations. |
GSAP + ScrollTrigger plugin and animation composables for the project.
app/plugins/gsap.ts - plugin, exports and helpersapp/composables/useEnterAnimations.ts - animation composables (see the composables skill)import {
gsap,
ScrollTrigger,
getMainScroller, // () => HTMLElement | null
animateInOnEnter, // ScrollTrigger helper
isElementInViewport, // (el, scroller?) => boolean
clearGSAPProps, // (elements) => void
gsapDefaults, // { ease: 'power3.out', duration: 0.8, clearProps: 'opacity,transform' }
scrollTriggerDefaults, // { start: 'top 80%', once: true }
} from '~/plugins/gsap'
const scroller = getMainScroller()
// default layout → document.querySelector('.shell-main')
// blog layout → document.querySelector('.blog-main')
// SSR → null
ScrollTrigger.defaults({ scroller }) is configured automatically in app:mounted and page:finish.
type AnimateInOnEnterOptions = {
from?: gsap.TweenVars // initial state (applied if the element is not in viewport)
to?: gsap.TweenVars // final state (include ease, duration, etc.)
trigger?: HTMLElement | null
scroller?: HTMLElement | null
start?: string // default: 'top 80%'
once?: boolean // default: true
}
animateInOnEnter(element, {
from: { opacity: 0, y: 30 },
to: { ...gsapDefaults, opacity: 1, y: 0 },
scroller: getMainScroller(),
start: 'top 80%',
once: true,
})
If the element is already visible in the viewport, from is ignored and it is cleared directly.
const gsapDefaults = {
ease: 'power3.out',
duration: 0.8,
clearProps: 'opacity,transform',
}
See the composables skill → useEnterAnimations() section.
<script setup>
const { label, titleEl, descriptionEl, setPanelRef, setupEnterAnimations, cleanupEnterAnimations } = useEnterAnimations()
onMounted(() => nextTick(() => setupEnterAnimations()))
onUnmounted(() => cleanupEnterAnimations())
</script>
See the composables skill → useGsapAnimations() section. Automatic cleanup in onBeforeUnmount.
const { setupAnimations } = useGsapAnimations()
onMounted(() => {
nextTick(() => {
setupAnimations(() => {
const scroller = getMainScroller()
gsap.from('.my-element', {
...gsapDefaults,
opacity: 0, y: 20,
scrollTrigger: {
trigger: '.my-element',
scroller,
start: 'top 80%',
once: true,
}
})
})
})
})
?gsapDebug=1localStorage.setItem('gsap:debug', '1')[gsap] logs in the console with setup, fallback and animation eventsonMounted or import.meta.clientuseGsapAnimations() or useEnterAnimations() (they create gsap.context() for cleanup)setupAnimations inside nextTick() within onMounted (layout ready)ScrollTrigger.refresh()gsap.set() with clearProps before hydration (causes SSR mismatch)