|
@@ -0,0 +1,347 @@
|
|
|
|
|
+<!DOCTYPE html>
|
|
|
|
|
+<html lang="en">
|
|
|
|
|
+<head>
|
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
+ <title>Layer 容器定义混合类型动画</title>
|
|
|
|
|
+ <link rel="stylesheet" href="../demo.css">
|
|
|
|
|
+ <link rel="stylesheet" href="../../xjs.css">
|
|
|
|
|
+ <style>
|
|
|
|
|
+ /* Keep Layer above the doc UI */
|
|
|
|
|
+ .layer-overlay { z-index: 99999; }
|
|
|
|
|
+ </style>
|
|
|
|
|
+ <style>
|
|
|
|
|
+ .controls {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ gap: 10px 12px;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ color: #b7b7b7;
|
|
|
|
|
+ }
|
|
|
|
|
+ .row {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ gap: 10px;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ }
|
|
|
|
|
+ .btn {
|
|
|
|
|
+ appearance: none;
|
|
|
|
|
+ border: 1px solid rgba(255,255,255,0.12);
|
|
|
|
|
+ background: rgba(255,255,255,0.04);
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ border-radius: 999px;
|
|
|
|
|
+ padding: 10px 14px;
|
|
|
|
|
+ font-weight: 650;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ transition: border-color 0.15s ease, background 0.15s ease;
|
|
|
|
|
+ }
|
|
|
|
|
+ .btn:hover { border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.06); }
|
|
|
|
|
+ .demo-visual { padding: 22px 24px; }
|
|
|
|
|
+ .hint { font-size: 12px; color: #8c8c8c; line-height: 1.5; margin-top: 10px; }
|
|
|
|
|
+ .hidden-dom { display: none; }
|
|
|
|
|
+ .step-card {
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ gap: 10px;
|
|
|
|
|
+ text-align: left;
|
|
|
|
|
+ }
|
|
|
|
|
+ .step-title {
|
|
|
|
|
+ font-weight: 650;
|
|
|
|
|
+ color: #1d1d1d;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .step-desc {
|
|
|
|
|
+ color: #4d4d4d;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ line-height: 1.5;
|
|
|
|
|
+ }
|
|
|
|
|
+ .field label {
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ margin-bottom: 6px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .field input, .field select {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ padding: 10px 12px;
|
|
|
|
|
+ border-radius: 10px;
|
|
|
|
|
+ border: 1px solid rgba(0,0,0,0.12);
|
|
|
|
|
+ outline: none;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ color: #111;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ }
|
|
|
|
|
+ </style>
|
|
|
|
|
+</head>
|
|
|
|
|
+<body>
|
|
|
|
|
+ <div class="container">
|
|
|
|
|
+ <div class="page-top">
|
|
|
|
|
+ <div class="crumb">UI › LAYER</div>
|
|
|
|
|
+ <div class="since">CUSTOM ANIMATION</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <h1>容器定义混合类型动画</h1>
|
|
|
|
|
+ <p class="description">
|
|
|
|
|
+ 使用 <code class="inline">step: '#container'</code> + <code class="inline">stepItem: '.item'</code>,
|
|
|
|
|
+ 通过 DOM 属性定义每一步的 <code class="inline">background / icon / width / height / iwidth / iheight / theme</code>,
|
|
|
|
|
+ 并展示 SVG 动画背景与 SVG 图标混合使用的效果。
|
|
|
|
|
+ </p>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="box-container">
|
|
|
|
|
+ <div class="demo-visual">
|
|
|
|
|
+ <div class="controls" style="margin-bottom: 14px;">
|
|
|
|
|
+ <span>点击按钮触发容器式 Steps</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="row">
|
|
|
|
|
+ <button class="btn" type="button" onclick="openContainerSteps()">Open container steps</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="hint">
|
|
|
|
|
+ Tip: 每个 stepItem 通过 <code class="inline">data-step-*</code> 控制动画与样式。
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="box-header">
|
|
|
|
|
+ <div class="box-title">Controls</div>
|
|
|
|
|
+ <div class="tabs">
|
|
|
|
|
+ <div class="tab active" onclick="switchTab('js')">JavaScript</div>
|
|
|
|
|
+ <div class="tab" onclick="switchTab('html')">HTML</div>
|
|
|
|
|
+ <div class="tab" onclick="switchTab('css')">CSS</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <pre id="js-code" class="code-view active">function openContainerSteps() {
|
|
|
|
|
+ if (typeof window.$ !== 'function') return;
|
|
|
|
|
+
|
|
|
|
|
+ Layer.run({
|
|
|
|
|
+ step: '#mix_steps',
|
|
|
|
|
+ stepItem: '.mix-step',
|
|
|
|
|
+ title: 'Container steps (mixed animations)',
|
|
|
|
|
+ showCancelButton: true
|
|
|
|
|
+ }).then((res) => {
|
|
|
|
|
+ if (res.isConfirmed) {
|
|
|
|
|
+ Layer.run({
|
|
|
|
|
+ title: 'Collected data',
|
|
|
|
|
+ icon: 'success',
|
|
|
|
|
+ popupAnimation: false,
|
|
|
|
|
+ replace: true,
|
|
|
|
|
+ html: '<pre>' + JSON.stringify(res.data, null, 2) + '</pre>'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}</pre>
|
|
|
|
|
+
|
|
|
|
|
+ <pre id="html-code" class="html-view"><button class="btn" type="button" onclick="openContainerSteps()">Open container steps</button>
|
|
|
|
|
+
|
|
|
|
|
+<div id="mix_steps" class="hidden-dom">
|
|
|
|
|
+ <div class="mix-step"
|
|
|
|
|
+ data-step-title="Step 1: Banner icon"
|
|
|
|
|
+ data-step-icon="svg:banner"
|
|
|
|
|
+ data-step-iwidth="10em"
|
|
|
|
|
+ data-step-iheight="6em"
|
|
|
|
|
+ data-step-width="520"
|
|
|
|
|
+ data-step-height="260"
|
|
|
|
|
+ data-step-theme="light">
|
|
|
|
|
+ <div class="step-card">
|
|
|
|
|
+ <div class="step-title">Welcome</div>
|
|
|
|
|
+ <div class="step-desc">This step uses a Lottie SVG icon with custom icon box size.</div>
|
|
|
|
|
+ <div class="field">
|
|
|
|
|
+ <label>Your name</label>
|
|
|
|
|
+ <input name="name" placeholder="Input will be collected">
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="mix-step"
|
|
|
|
|
+ data-step-title="Step 2: SVG background"
|
|
|
|
|
+ data-step-background="svg(BallSorting.json)"
|
|
|
|
|
+ data-step-width="560"
|
|
|
|
|
+ data-step-height="280"
|
|
|
|
|
+ data-step-theme="light">
|
|
|
|
|
+ <div class="step-card">
|
|
|
|
|
+ <div class="step-title">Pick a plan</div>
|
|
|
|
|
+ <div class="step-desc">This step uses a Lottie background animation.</div>
|
|
|
|
|
+ <div class="field">
|
|
|
|
|
+ <label>Plan</label>
|
|
|
|
|
+ <select name="plan">
|
|
|
|
|
+ <option value="free">Free</option>
|
|
|
|
|
+ <option value="pro">Pro</option>
|
|
|
|
|
+ <option value="team">Team</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="mix-step"
|
|
|
|
|
+ data-step-title="Step 3: Mixed icon + css background"
|
|
|
|
|
+ data-step-icon="svg:BallSorting"
|
|
|
|
|
+ data-step-iwidth="8em"
|
|
|
|
|
+ data-step-iheight="8em"
|
|
|
|
|
+ data-step-background="css(background: linear-gradient(135deg, rgba(32, 32, 48, 0.9), rgba(10, 10, 12, 0.92));)"
|
|
|
|
|
+ data-step-width="520"
|
|
|
|
|
+ data-step-height="260"
|
|
|
|
|
+ data-step-theme="light">
|
|
|
|
|
+ <div class="step-card">
|
|
|
|
|
+ <div class="step-title">Confirm</div>
|
|
|
|
|
+ <div class="step-desc">Background and icon are both customized here.</div>
|
|
|
|
|
+ <div class="field">
|
|
|
|
|
+ <label>Note</label>
|
|
|
|
|
+ <input name="note" placeholder="Optional note">
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</div></pre>
|
|
|
|
|
+
|
|
|
|
|
+ <pre id="css-code" class="css-view">.hidden-dom { display: none; }
|
|
|
|
|
+.step-card { display: grid; gap: 10px; text-align: left; }
|
|
|
|
|
+.step-title { font-weight: 650; color: #1d1d1d; font-size: 14px; }
|
|
|
|
|
+.step-desc { color: #4d4d4d; font-size: 13px; line-height: 1.5; }</pre>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="feature-desc">
|
|
|
|
|
+ <strong>功能说明:</strong>容器式 steps 会根据 <code class="inline">data-step-*</code> 动态设置每一步的背景与图标,
|
|
|
|
|
+ 并通过内置表单收集机制把 <code class="inline">input/select</code> 汇总到 <code class="inline">res.data</code>。
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- Hidden DOM container -->
|
|
|
|
|
+ <div id="mix_steps" class="hidden-dom">
|
|
|
|
|
+ <div class="mix-step"
|
|
|
|
|
+ data-step-title="Step 1: Banner icon"
|
|
|
|
|
+ data-step-icon="svg:banner"
|
|
|
|
|
+ data-step-iwidth="10em"
|
|
|
|
|
+ data-step-iheight="6em"
|
|
|
|
|
+ data-step-width="520"
|
|
|
|
|
+ data-step-height="260"
|
|
|
|
|
+ data-step-theme="light">
|
|
|
|
|
+ <div class="step-card">
|
|
|
|
|
+ <div class="step-title">Welcome</div>
|
|
|
|
|
+ <div class="step-desc">This step uses a Lottie SVG icon with custom icon box size.</div>
|
|
|
|
|
+ <div class="field">
|
|
|
|
|
+ <label>Your name</label>
|
|
|
|
|
+ <input name="name" placeholder="Input will be collected">
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="mix-step"
|
|
|
|
|
+ data-step-title="Step 2: SVG background"
|
|
|
|
|
+ data-step-background="svg(BallSorting.json)"
|
|
|
|
|
+ data-step-width="560"
|
|
|
|
|
+ data-step-height="280"
|
|
|
|
|
+ data-step-theme="light">
|
|
|
|
|
+ <div class="step-card">
|
|
|
|
|
+ <div class="step-title">Pick a plan</div>
|
|
|
|
|
+ <div class="step-desc">This step uses a Lottie background animation.</div>
|
|
|
|
|
+ <div class="field">
|
|
|
|
|
+ <label>Plan</label>
|
|
|
|
|
+ <select name="plan">
|
|
|
|
|
+ <option value="free">Free</option>
|
|
|
|
|
+ <option value="pro">Pro</option>
|
|
|
|
|
+ <option value="team">Team</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="mix-step"
|
|
|
|
|
+ data-step-title="Step 3: Mixed icon + css background"
|
|
|
|
|
+ data-step-icon="svg:BallSorting"
|
|
|
|
|
+ data-step-iwidth="8em"
|
|
|
|
|
+ data-step-iheight="8em"
|
|
|
|
|
+ data-step-background="css(background: linear-gradient(135deg, rgba(32, 32, 48, 0.9), rgba(10, 10, 12, 0.92));)"
|
|
|
|
|
+ data-step-width="520"
|
|
|
|
|
+ data-step-height="260"
|
|
|
|
|
+ data-step-theme="light">
|
|
|
|
|
+ <div class="step-card">
|
|
|
|
|
+ <div class="step-title">Confirm</div>
|
|
|
|
|
+ <div class="step-desc">Background and icon are both customized here.</div>
|
|
|
|
|
+ <div class="field">
|
|
|
|
|
+ <label>Note</label>
|
|
|
|
|
+ <input name="note" placeholder="Optional note">
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="doc-nav" aria-label="Previous and next navigation">
|
|
|
|
|
+ <a href="#" id="prevLink" onclick="goPrev(); return false;">
|
|
|
|
|
+ <span><span class="nav-label">Previous</span><br><span class="nav-title" id="prevTitle">—</span></span>
|
|
|
|
|
+ <span aria-hidden="true">←</span>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <div class="nav-center" id="navCenter">Layer</div>
|
|
|
|
|
+ <a href="#" id="nextLink" onclick="goNext(); return false;">
|
|
|
|
|
+ <span><span class="nav-label">Next</span><br><span class="nav-title" id="nextTitle">—</span></span>
|
|
|
|
|
+ <span aria-hidden="true">→</span>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <script src="../highlight_css.js"></script>
|
|
|
|
|
+ <!-- Dev/test: load source files directly with cache-bust (avoid stale iframe cache) -->
|
|
|
|
|
+ <script>
|
|
|
|
|
+ (function () {
|
|
|
|
|
+ var b = Date.now();
|
|
|
|
|
+ document.write('<script src="../../animal.js?_=' + b + '"><\/script>');
|
|
|
|
|
+ document.write('<script src="../../layer.js?_=' + b + '"><\/script>');
|
|
|
|
|
+ document.write('<script>try{if(window.animal&&!window.xjs)window.xjs=window.animal;}catch(e){}<\/script>');
|
|
|
|
|
+ })();
|
|
|
|
|
+ </script>
|
|
|
|
|
+ <script>
|
|
|
|
|
+ const CURRENT = 'layer/test_custom_animation_container_steps.html';
|
|
|
|
|
+
|
|
|
|
|
+ function switchTab(tab) {
|
|
|
|
|
+ document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
|
|
|
|
|
+ document.querySelectorAll('.code-view, .html-view, .css-view').forEach(v => v.classList.remove('active'));
|
|
|
|
|
+ if (tab === 'js') {
|
|
|
|
|
+ document.querySelector('.tabs .tab:nth-child(1)')?.classList.add('active');
|
|
|
|
|
+ document.getElementById('js-code')?.classList.add('active');
|
|
|
|
|
+ } else if (tab === 'html') {
|
|
|
|
|
+ document.querySelector('.tabs .tab:nth-child(2)')?.classList.add('active');
|
|
|
|
|
+ document.getElementById('html-code')?.classList.add('active');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ document.querySelector('.tabs .tab:nth-child(3)')?.classList.add('active');
|
|
|
|
|
+ document.getElementById('css-code')?.classList.add('active');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function openContainerSteps() {
|
|
|
|
|
+ if (typeof window.$ !== 'function') return;
|
|
|
|
|
+ Layer.run({
|
|
|
|
|
+ step: '#mix_steps',
|
|
|
|
|
+ stepItem: '.mix-step',
|
|
|
|
|
+ title: 'Container steps (mixed animations)',
|
|
|
|
|
+ showCancelButton: true
|
|
|
|
|
+ }).then((res) => {
|
|
|
|
|
+ if (res.isConfirmed) {
|
|
|
|
|
+ Layer.run({
|
|
|
|
|
+ title: 'Collected data',
|
|
|
|
|
+ icon: 'success',
|
|
|
|
|
+ popupAnimation: false,
|
|
|
|
|
+ replace: true,
|
|
|
|
|
+ html: '<pre>' + JSON.stringify(res.data, null, 2) + '</pre>'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function goPrev() { window.parent?.docNavigatePrev?.(CURRENT); }
|
|
|
|
|
+ function goNext() { window.parent?.docNavigateNext?.(CURRENT); }
|
|
|
|
|
+
|
|
|
|
|
+ function syncNavLabels() {
|
|
|
|
|
+ const api = window.parent?.docGetPrevNext;
|
|
|
|
|
+ if (typeof api !== 'function') return;
|
|
|
|
|
+ const { prev, next, current } = api(CURRENT) || {};
|
|
|
|
|
+ const prevLink = document.getElementById('prevLink');
|
|
|
|
|
+ const nextLink = document.getElementById('nextLink');
|
|
|
|
|
+ if (prev) document.getElementById('prevTitle').textContent = prev.title || prev.url;
|
|
|
|
|
+ else { prevLink.style.visibility = 'hidden'; }
|
|
|
|
|
+ if (next) document.getElementById('nextTitle').textContent = next.title || next.url;
|
|
|
|
|
+ else { nextLink.style.visibility = 'hidden'; }
|
|
|
|
|
+ document.getElementById('navCenter').textContent = (current && current.group) ? current.group : 'Layer';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try { window.parent?.setMiddleActive?.(CURRENT); } catch {}
|
|
|
|
|
+ syncNavLabels();
|
|
|
|
|
+ </script>
|
|
|
|
|
+</body>
|
|
|
|
|
+</html>
|