jacerider/neo_animate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jacerider/neo_animate

Composer 安装命令:

composer require jacerider/neo_animate

包简介

Scroll-triggered viewport animations for Neo components: reveal, stagger, parallax, and exit animations.

README 文档

README

Scroll-triggered viewport animations for Neo components: reveal on enter, item stagger, parallax, and optional exit animations. Built on the existing neo/animate catalog (an animate.css fork namespaced as .neo-animate--*) plus a small IntersectionObserver driver — no external animation library.

How it works

Authors write marker classes (they carry no animation CSS themselves); the driver (src/js/neo-animate.ts) applies the real catalog classes at the right moments. Only the driver ever writes neo-animate--animated and raw catalog names. Elements queued for a reveal are pre-hidden (opacity only) behind an html.neo-animate-ready gate added by an inline head script — no-JS visitors and prefers-reduced-motion users always see content.

Class API

Class / attribute Written by Meaning
neo-animate prop / dev Reveal this element on viewport enter
neo-animate-enter--<catalogName> prop / dev Which catalog animation plays on enter (e.g. neo-animate-enter--fadeInUpSmall)
neo-animate-exit--<catalogName> dev Play this catalog animation on exit, then re-arm (implies repeat)
neo-animate-repeat dev Re-arm on exit without an exit animation
neo-animate-stagger prop / dev Cascade .neo-animate-item descendants (+100ms each; tune with data-neo-animate-stagger="<ms>"). Items are observed independently and cascade as they enter the viewport — not when the root does — so a slow scroller always sees it
neo-animate-item dev, in twig Marks a staggerable child
neo-animate--{fastest,faster,fast,slow,slower,slowest} prop / dev Speed — catalog compound modifiers, inert until armed
neo-animate--delay-{fastest…slowest} prop / dev Delay — same
data-neo-parallax="<speed>" dev rAF parallax (e.g. 0.15, clamped ±1). Never on the same element as a reveal — transforms fight; use a child/wrapper

Playground (/admin/config/neo/animate)

A frontend-developer tool under Configuration → Neo → Animate:

  • Playground — pick animation / speed / delay / repeat, preview live with a Replay button, and copy the result in three forms (marker classes, the neo_animate Twig filter, the Alchemist prop values).
  • Gallery — every catalog animation grouped by family, click a tile to replay.
  • Stagger and Parallax live demos.
  • Simulate reduced motion toggle to preview the accessible fallback.

Gated by the access neo_animate demo permission (uid 1 bypasses; grant it to any role that should see the tool).

Twig authoring (ordinary templates)

For non-Alchemist templates (node/views/block/field twigs) two filters apply the same animations without hand-writing marker classes — no library attach needed (the driver is global):

{# animate an attributes object #}
<div{{ attributes|neo_animate('fade-up', {delay: 200, speed: 'slow'}) }}>…</div>

{# stagger a render array's children: +200ms every 2nd item #}
{{ content.field_images|neo_animate_children('zoom-in', 2, 200) }}

Friendly names (fade, fade-up/down/left/right, zoom-in/out, slide-*, flip-*, bounce) map to catalog effects; any other value passes through as a raw catalog name, so the full catalog (tada, jello, fadeInUpSmall, …) is reachable. Options: speed (bucket), delay (ms number or bucket string), once (false → replays via repeat), exit (a catalog name). Precise delay values ride on a data-neo-animate-delay attribute the driver applies on reveal.

Alchemist props

Any component opts in with:

animate:
  type: animate
animate_speed:
  type: animate_speed
animate_delay:
  type: animate_delay
animate_stagger:
  type: animate_stagger

Stagger additionally needs the component's repeating element to carry the neo-animate-item class in its twig. Editors picking Stagger on a component without item markers is a harmless no-op; Animation "None" never hides anything.

Behavior matrix

Context Behavior
Live page Pre-hidden, reveals at 12% visibility, once by default
Alchemist preview iframe Plays immediately on every reload (demo mode); exit/repeat disabled
Preview screenshot capture (screenshotComponents postMessage) Running animations jump to their final frame before html2canvas captures
prefers-reduced-motion Nothing hidden, nothing animated
JavaScript disabled Nothing hidden (ready class never added)

Pitfalls

  • Catalog speed/delay modifiers are compound selectors — inert without neo-animate--animated. That's by design; don't "fix" them.
  • A custom style list for the animate prop must keep a none: { value: '' } option (empty styles maps are rejected).
  • All classes here are plain CSS (catalog + this module) — no Tailwind rebuild is needed when using them; drush cr after editing prop defs or component yml.

jacerider/neo_animate 适用场景与选型建议

jacerider/neo_animate 是一款 基于 TypeScript 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 jacerider/neo_animate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jacerider/neo_animate 我们能提供哪些服务?
定制开发 / 二次开发

基于 jacerider/neo_animate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 27
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: TypeScript

其他信息

  • 授权协议: proprietary
  • 更新时间: 2024-09-09