mcpField
C
cuboid-carousel

cuboid-carousel

github.com/heygen-com创意与媒体74.7k10.5k 次安装今天更新
代码仓库

关于 cuboid-carousel

这是用于 Hyperframes 的圆角倒角长方体轮播动画组合,可承载卡片内容,并调整几何、外观、灯光、摄像机与运动时序,适合制作可定位的短篇 3D 动画。

主要功能

  1. 01长方体作为整体飞入与离场
  2. 02错开旋转并停留展示
  3. 03卡片内容可来自列表或 JSON
  4. 04可调几何形状与材质
  5. 05可配置灯光、摄像机和时序

适用场景

  1. 01以 3D 轮播展示卡片
  2. 02为重点内容设置展示停留
  3. 03自定义长方体运动与场景外观

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/heygen-com/hyperframes --skill cuboid-carousel

安装后在 Claude Code 中输入/cuboid-carousel确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

cuboid-carousel.html
registry-item.json
assets/
gsap-3.14.2.min.js
GSAP-NOTICE.txt
Three-LICENSE.txt
three.module.min.js
assets/addons/environments/
RoomEnvironment.js
assets/addons/utils/
BufferGeometryUtils.js

详细介绍

Cuboid Carousel

圆角倒角长方体承载着卡片内容,作为一个刚性整体从右侧飞入,以每个长方体旋转错开的方式巡航,减速后停留在主视觉位置,随后从左侧离开。间距根据长方体尺寸和可达的最大 X 轴半范围计算,因此长方体绝不会重叠。40 个变量沿用原始 DialKit 架构:几何体、材质、灯光、阴影、背景、摄像机,以及每个片段的持续时间和缓动。卡片来自内置列表或 JSON 变量。

组合 ID:cuboid-carousel。时长 6.666666666666667 s,帧率为 30 fps,分辨率为 1920×1080。

文件

  • cuboid-carousel.html(38 KB)
  • assets/Three-LICENSE.txt(1 KB)
  • assets/addons/environments/RoomEnvironment.js(5 KB)
  • assets/addons/utils/BufferGeometryUtils.js(36 KB)
  • assets/cuboid-motion.js(593 KB)
  • assets/gsap-3.14.2.min.js(128 KB)
  • assets/GSAP-NOTICE.txt(1 KB)
  • assets/three.core.min.js(554 KB)
  • assets/three.module.min.js(468 KB)

安装

运行 npx hyperframes add cuboid-carousel 进行安装;默认情况下,上述文件会放在 compositions/cuboid-carousel/ 下。然后从宿主 index.html 挂载此区块:

<div
  data-composition-id="cuboid-carousel"
  data-composition-src="compositions/cuboid-carousel/cuboid-carousel.html"
  data-start="0"
  data-duration="6.666666666666667"
  data-track-index="1"
  data-width="1920"
  data-height="1080"
></div>

如需使用自定义值进行渲染,请直接指定组合文件:

npx --yes [email protected] render 'compositions/cuboid-carousel/cuboid-carousel.html' --variables '{"cardsJson":"","heroCard":4}'

变量

运行时通过 window.__hyperframes.getVariables() 读取;变量声明在组合根节点的 data-composition-variables 属性中(单引号属性,纯 JSON)。

idtypedefaultlabel / range
cardsJsonstring""内容 · 卡片 JSON(可选,参见源文件中的 CARDS)
heroCardnumber4内容 · 主卡片(从 1 开始计数)1–12,步长为 1
countnumber8内容 · 重复卡片数量 1–12,步长为 1
gapnumber0.01布局 · 长方体之间的额外间距 0–1.5,步长为 0.005
cuboidWidthnumber1.7长方体 · 宽度 0.3–5,步长为 0.01
cuboidHeightnumber2.4长方体 · 高度 0.3–6,步长为 0.01
cuboidDepthnumber0.14长方体 · 厚度(深度)0.02–2,步长为 0.01
cornerRadiusnumber0.105长方体 · 圆角半径 0–0.6,步长为 0.005
bevelSizenumber0.03长方体 · 倒角尺寸(边缘倒角)0–0.3,步长为 0.001
bevelThicknessnumber0.04长方体 · 倒角厚度 0–0.3,步长为 0.001
smoothnessnumber32长方体 · 平滑度(分段数)1–32,步长为 1
bodyColorcolor"#242424"长方体 · 主体颜色
roughnessnumber0.6长方体 · 粗糙度 0–1,步长为 0.01
metalnessnumber0.4长方体 · 金属度 0–1,步长为 0.01
heroScalenumber1主卡片 · 单独显示时的缩放比例 1–1.6,步长为 0.01
heroFillIntensitynumber0.55主卡片 · 表面光照强度 0–2,步长为 0.05
heroExitXnumber288主卡片 · 退出时的 X 轴旋转角度 -720–720,步长为 1
heroExitYnumber-234主卡片 · 退出时的 Y 轴旋转角度 -720–720,步长为 1
heroExitZnumber198主卡片 · 退出时的 Z 轴旋转角度 -720–720,步长为 1
ambientIntensitynumber0.35灯光 · 环境光强度 0–4,步长为 0.01
ambientColorcolor"#ffffff"灯光 · 环境光颜色
topIntensitynumber3.1灯光 · 顶部灯组强度 0–12,步长为 0.05
topColorcolor"#ffffff"灯光 · 顶部灯组颜色
bottomIntensitynumber2.15灯光 · 底部灯组强度 0–12,步长为 0.05
bottomColorcolor"#ffcaad"灯光 · 底部灯组颜色
keyIntensitynumber5灯光 · 主灯组强度 0–12,步长为 0.05
keyColorcolor"#ffe9d6"灯光 · 主灯组颜色
shadowRadiusnumber44.5阴影 · 地图尺寸为 2048 时的柔和度 0–50,步长为 0.5
shadowMapSizenumber2048阴影 · 地图尺寸 512–4096,步长为 256
backdropcolor"#0b0d13"背景 · 颜色
cameraFovnumber11摄像机 · 初始视野 10–90,步长为 0.5
cameraXnumber-1.65摄像机 · 初始 X 坐标 -20–20,步长为 0.05
cameraYnumber8.5摄像机 · 初始 Y 坐标 -20–20,步长为 0.05
cameraZnumber-8.508708摄像机 · 初始 Z 坐标(距离)-20–50,步长为 0.1
cameraSettleFramenumber70摄像机 · 稳定帧(30 fps)20–90,步长为 1
handheldStrengthnumber1摄像机 · 手持稳定强度 0–1,步长为 0.05
cameraTargetFovnumber34摄像机目标 · 视野 10–90,步长为 0.5
cameraTargetXnumber-7.25摄像机目标 · X 坐标 -20–20,步长为 0.05
cameraTargetYnumber1.15摄像机目标 · Y 坐标 -20–20,步长为 0.05
cameraTargetZnumber6.2摄像机目标 · Z 坐标 2–50,步长为 0.1

运行时契约

  • 一个已暂停的 GSAP 时间轴,注册在 window.__timelines["cuboid-carousel"]。
  • 在 hf-seek CustomEvent 上重新同步;每一帧都是时间的闭式函数(仅使用带种子的 PRNG,不使用 rAF 循环或 Date.now)。
  • 渲染器:WebGL、GSAP、Canvas 2D、PMREM、阴影贴图。每个运行实例的预算约为 350 MB;一次只运行一个实例。
  • 外部运行时依赖:./assets/three.module.min.js、./assets/addons/。
  • 使用 Google Fonts 提供的 Web 字体:Inter。

编辑规则(来自源项目)

  1. 将 data-composition-variables 保留为单引号属性,并使用普通的 " JSON。切勿通过 Studio 的 Design 面板保存该属性。
  2. 不要在静态标记中放入 <canvas>;应在运行时创建。
  3. 将每个视觉状态都设为 t 的函数;确保支持跳转定位,才能让该区块可渲染。

评论

支持 Markdown