/htmlpptskill:html-slide-effectsfrom htmlpptskill
Adds reveal.js slide effects: fragments, Auto-Animate, 3D flips, GSAP text animations, Three.js, timer bars, lightbox, scroll view. Controls performance and offline usage.
Ships in htmlpptskill. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
使用時機:使用者想讓 HTML 簡報更生動、更好講、更適合現場互動,或問「有什麼特效或技巧可以加」。簡報本體的製作流程(版型、圖片、QA、轉 PPTX)在 html-slide-deck;本 skill 只管加在其上的效果。加完效果一律回頭跑 html-slide-deck 的 qa-screenshots.mjs。
固定規則:開始前先讀本 skill 目錄下的 references/fixed-rules.md,全程遵守(加效果也不得刪頁)。
先問使用者:聽眾是誰、現場有沒有網路、播放電腦的等級、想要「穩重」還是「驚豔」。醫療或學術聽眾預設偏穩重,只用第 1、2 級。
<ul>
<li class="fragment">第一點</li>
<li class="fragment fade-up">第二點</li>
<li class="fragment highlight-current-blue">目前講到這點</li>
</ul>
<div class="fragment" data-fragment-index="2">指定順序</div>
適合:條列、決策樹一步一步揭曉、比較表逐欄出現。
<section data-auto-animate>
<div data-id="box" style="width:200px">Lv2</div>
</section>
<section data-auto-animate data-auto-animate-duration="0.8">
<div data-id="box" style="width:900px">Lv2 Cloudflare Pages</div>
</section>
src 會自動配對;data-id 可手動指定配對。<section data-transition="zoom">章節頁</section>
<section data-transition="convex-in fade-out" data-transition-speed="slow">…</section>
樣式:none、fade、slide、convex、concave、zoom;背景用 data-background-transition。建議全場 fade+transitionSpeed:'fast',只有章節頁用 zoom(每頁都 slide 看久會累,也讓換段落失去標記)。完整程式碼與快捷鍵見 repo docs/TECHNIQUES.md。
r-fit-text:文字自動放到最大,適合一句話頁。r-stretch:圖片或影片填滿剩餘高度。r-stack:多個元素疊在同一位置,搭配 fragment 依序替換。?view=scroll,或設定 view: 'scroll'。scrollActivationWidth 控制手機是否自動切換;設 null 或 0 則關閉。<img src="shot.png" data-preview-image>
<video data-preview-video="demo.mp4"></video>
需要 reveal.js 5.2 以上;從 5.1 升級後要重跑驗收。
<section data-background-video="demo.mp4" data-background-video-muted data-background-video-loop></section>
適合:現場 demo 的預錄備案。
S 講者備註、Esc/O 總覽、F 全螢幕、B 或 . 黑屏、G 跳頁、網址加 ?print-pdf 匯出 PDF。
| 外掛 | 用途 | 注意 |
|---|---|---|
| elapsed-time-bar(tkrkt) | 底部時間進度條,和頁數進度條對照,看出講快還是講慢 | 設 allottedTime(毫秒),可暫停、重設 |
| Chalkboard(rajgoel) | C 在投影片上畫、B 開黑板、D 下載畫記 | 需要 Font Awesome(自有授權),要一起內嵌才能離線;B 與 reveal 內建黑屏鍵衝突,要改鍵 |
| Spotlight(denniskniep) | 滑鼠變聚光燈,其他區域變暗 | 講解截圖細節時很有效 |
| reveal.js-menu | 側邊目錄快速跳頁 | Q&A 時找頁面方便 |
內嵌方式:把外掛的 JS 與 CSS 讀進建置腳本,直接寫進 <script> 與 <style>,並加入 plugins: [...]。套件名稱與版本以各外掛 repo 為準,不要猜 npm 名稱;抓不到就自己寫(計時條約 20 行)。
不建議:需要伺服器的投票或問答外掛(Poll、Seminar、Questions)。現場互動改用使用者自己的課堂互動工具,並準備口頭提問作為沒網路時的備案。
卡片翻面:
.flip { perspective: 1000px; }
.flip .inner { transition: transform .8s; transform-style: preserve-3d; position: relative; }
.flip.visible .inner { transform: rotateY(180deg); }
.flip .front, .flip .back { backface-visibility: hidden; position: absolute; inset: 0; }
.flip .back { transform: rotateY(180deg); }
<div class="flip fragment custom"><div class="inner"><div class="front">工具名稱</div><div class="back">教學用法</div></div></div>
.reveal .fragment.custom { opacity: 1; visibility: inherit; } /* 沒有 custom 時,卡片在點擊前是隱形的,正面看不到 */
.flip.visible .inner { transform: rotateY(180deg); }
(fragment 顯示時加上 visible class → 翻面;一組卡片想一次翻,把 fragment custom 放在容器上,卡片用 transition-delay 錯開。)
立體階梯:父層 perspective: 1200px,每一階 transform: rotateX(20deg) translateZ(n*40px),每階加 fragment 依序升起。
卡片牆飛入:每張卡片的起始狀態是 transform: translateZ(-800px) rotateY(40deg); opacity: 0,出現時回到 0;用 transition-delay 錯開。
gsap,內嵌 dist/gsap.min.js(約 70 KB);需要外掛時一起內嵌,例如 dist/SplitText.min.js。Reveal.on('slidechanged', (e) => {
if (e.currentSlide.id === 'cover') {
gsap.from('#cover h1 .char', { y: 40, opacity: 0, stagger: 0.04, duration: 0.6 });
}
});
const o = { v: 0 };
gsap.to(o, { v: 13, duration: 1.2, onUpdate: () => (el.textContent = Math.round(o.v)) });
適合:封面標題逐字浮現、收尾數字計數、流程圖 SVG 形狀變形。
Reveal.on('slidechanged', (e) => (running = e.currentSlide.id === 'cover'));
examples/three-particles-entry.js(掛在 Reveal.getSlideBackground(0),只在封面跑)。data-x、data-y、data-z、data-rotate-y、data-scale 定位,頁與頁之間鏡頭飛行。適合多頁式網站的頁面間轉場;reveal.js 單頁簡報通常不需要。
qrcode 套件在建置時產生 SVG 內嵌),並用解碼驗證網址正確。@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
const REDUCE = matchMedia('(prefers-reduced-motion: reduce)').matches;
// STATIC:QA 截圖(Playwright)與 ?print-pdf 時關掉所有動畫,截到的才是最終狀態
const STATIC = navigator.webdriver || location.search.indexOf('print-pdf') >= 0;
if (STATIC) document.documentElement.classList.add('static');
Reveal.initialize({ transition: REDUCE ? 'fade' : 'slide', autoAnimateDuration: STATIC ? 0 : 0.9, pdfSeparateFragments: false /* ... */ });
if (REDUCE || STATIC) { /* 不啟動 GSAP 與 Three.js、計時條,直接顯示最終狀態 */ }
html.static .flip .inner, html.static .reveal .fragment { transition: none !important; }
prefers-reduced-motion 的 CSS 只作用在自己加的效果(.flip、GSAP 目標、fragment),不要用全域 * 把 reveal 換頁也壓掉。
| 風格 | 使用 |
|---|---|
| 穩重(醫學、學術) | Fragments、Auto-Animate、章節 zoom、時間進度條、點圖放大、頁內互動 |
| 中間 | 再加 CSS 3D 階梯或卡片翻面、GSAP 封面與收尾 |
| 驚豔(發表會、開幕) | 再加 Three.js 封面、卡片牆飛入、Spotlight |
Reveal.configure({ transition: 'none' })),沒有溢出?print-pdf 匯出時所有內容都出現render-slides.mjs 轉講義時只會截到最終狀態(腳本已關閉轉場);要每個 fragment 各一張就先把該頁拆成多頁。Reveal.initialize 之前;找最後一個 </body>(notes.js 原始碼裡也有一個)。elapsed-time-bar 之類的外掛後,qa-screenshots.mjs 的 errors 若出現外掛的 console error 要先修,再看版面。What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
reveal.js, slide-animations, presentation-effects, gsap, three-js
npx claudepluginhub keanu77/htmlpptskill --plugin htmlpptskill2 skills in this plugin
Other plugins' skills for the same job