@@ -165,6 +165,106 @@ <h3 style="color: #2a2a2a; margin-bottom: 20px; font-size: 28px; text-align: cen
165165player.init().then(() => player.play());</ code > </ pre >
166166 </ div >
167167
168+ <!-- ScrollFrameCanvas 初始化参数说明 -->
169+ < div style ="background: #f8f9fa; padding: 40px; border-radius: 12px; margin-bottom: 40px; ">
170+ < h3 style ="color: #2a2a2a; margin-bottom: 30px; font-size: 28px; text-align: center; ">
171+ 📋 ScrollFrameCanvas 初始化参数说明
172+ </ h3 >
173+ < div style ="display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 30px; ">
174+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
175+ < h4 style ="color: #007acc; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 基础配置</ h4 >
176+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
177+ < div style ="margin-bottom: 8px; "> < strong > canvasEle:</ strong > HTMLCanvasElement - Canvas 元素(必填)</ div >
178+ < div style ="margin-bottom: 8px; "> < strong > scrollbarEle:</ strong > HTMLElement | Window | Document - 滚动容器(必填)</ div >
179+ < div style ="margin-bottom: 8px; "> < strong > scrollAxis:</ strong > 'x' | 'y' - 滚动轴方向(必填)</ div >
180+ < div style ="margin-bottom: 8px; "> < strong > frameMapper:</ strong > Function - 滚动像素到帧索引的映射函数(必填)</ div >
181+ </ div >
182+ </ div >
183+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
184+ < h4 style ="color: #007acc; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 数据源配置</ h4 >
185+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
186+ < div style ="margin-bottom: 8px; "> < strong > images:</ strong > Array<HTMLImageElement | ImageBitmap | string> - 图片数组</ div >
187+ < div style ="margin-bottom: 8px; "> < strong > total:</ strong > number - 总帧数</ div >
188+ < div style ="margin-bottom: 8px; "> < strong > imageFactory:</ strong > Function - 异步图片工厂函数</ div >
189+ < div style ="margin-bottom: 8px; "> < strong > maxConcurrentLoads:</ strong > number - 最大并发加载数(默认: 6)</ div >
190+ </ div >
191+ </ div >
192+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
193+ < h4 style ="color: #007acc; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 渲染配置</ h4 >
194+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
195+ < div style ="margin-bottom: 8px; "> < strong > scaleMode:</ strong > 'contain' | 'cover' | 'fill' - 缩放模式(默认: 'contain')</ div >
196+ < div style ="margin-bottom: 8px; "> < strong > resetScrollOnInit:</ strong > boolean - 初始化时重置滚动位置(默认: true)</ div >
197+ < div style ="margin-bottom: 8px; "> < strong > exitAnimationFrameRate:</ strong > number - 退出动画帧率(默认: 75)</ div >
198+ </ div >
199+ </ div >
200+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
201+ < h4 style ="color: #007acc; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 性能优化</ h4 >
202+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
203+ < div style ="margin-bottom: 8px; "> < strong > large.enabled:</ strong > boolean - 启用分层加载(默认: true)</ div >
204+ < div style ="margin-bottom: 8px; "> < strong > large.factor:</ strong > number - 分层因子,必须是2的幂次方(默认: 4)</ div >
205+ < div style ="margin-bottom: 8px; "> < strong > large.showBackgroundProgress:</ strong > boolean - 显示后台加载进度(默认: true)</ div >
206+ </ div >
207+ </ div >
208+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
209+ < h4 style ="color: #007acc; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 事件回调</ h4 >
210+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
211+ < div style ="margin-bottom: 8px; "> < strong > onFrame:</ strong > (frame: number, offset: number) => void - 帧更新回调</ div >
212+ < div style ="margin-bottom: 8px; "> < strong > onComplete:</ strong > () => void - 动画完成回调</ div >
213+ < div style ="margin-bottom: 8px; "> < strong > onInitComplete:</ strong > () => void - 初始化完成回调</ div >
214+ < div style ="margin-bottom: 8px; "> < strong > onError:</ strong > (error: Error) => void - 错误回调</ div >
215+ </ div >
216+ </ div >
217+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
218+ < h4 style ="color: #007acc; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 自定义渲染</ h4 >
219+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
220+ < div style ="margin-bottom: 8px; "> < strong > customMainLoading:</ strong > Function - 自定义主加载动画</ div >
221+ < div style ="margin-bottom: 8px; "> < strong > customBackgroundLoading:</ strong > Function - 自定义后台加载动画</ div >
222+ </ div >
223+ </ div >
224+ </ div >
225+ </ div >
226+
227+ <!-- ScrollFrameCanvas 事件、实例函数说明 -->
228+ < div style ="background: #f8f9fa; padding: 40px; border-radius: 12px; margin-bottom: 40px; ">
229+ < h3 style ="color: #2a2a2a; margin-bottom: 30px; font-size: 28px; text-align: center; ">
230+ 🔧 ScrollFrameCanvas 事件、实例函数说明
231+ </ h3 >
232+ < div style ="display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 30px; ">
233+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
234+ < h4 style ="color: #28a745; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 生命周期方法</ h4 >
235+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
236+ < div style ="margin-bottom: 8px; "> < strong > init():</ strong > Promise<this> - 初始化并预加载所有帧</ div >
237+ < div style ="margin-bottom: 8px; "> < strong > destroy():</ strong > void - 销毁实例并清理资源</ div >
238+ </ div >
239+ </ div >
240+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
241+ < h4 style ="color: #28a745; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 播放控制</ h4 >
242+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
243+ < div style ="margin-bottom: 8px; "> < strong > play():</ strong > void - 开始播放动画</ div >
244+ < div style ="margin-bottom: 8px; "> < strong > pause():</ strong > void - 暂停播放</ div >
245+ < div style ="margin-bottom: 8px; "> < strong > stop():</ strong > void - 停止并重置到第0帧</ div >
246+ </ div >
247+ </ div >
248+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
249+ < h4 style ="color: #28a745; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 帧控制</ h4 >
250+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
251+ < div style ="margin-bottom: 8px; "> < strong > setFrame(frameIndex: number):</ strong > void - 设置当前帧</ div >
252+ < div style ="margin-bottom: 8px; "> < strong > getCurrentFrame():</ strong > number - 获取当前帧索引</ div >
253+ < div style ="margin-bottom: 8px; "> < strong > getTotalFrames():</ strong > number - 获取总帧数</ div >
254+ </ div >
255+ </ div >
256+ < div style ="background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); ">
257+ < h4 style ="color: #28a745; margin-bottom: 15px; font-size: 18px; font-weight: 600; "> 事件系统</ h4 >
258+ < div style ="font-size: 14px; line-height: 1.6; color: #333; ">
259+ < div style ="margin-bottom: 8px; "> < strong > on('frame', callback):</ strong > 监听帧更新事件</ div >
260+ < div style ="margin-bottom: 8px; "> < strong > on('complete', callback):</ strong > 监听动画完成事件</ div >
261+ < div style ="margin-bottom: 8px; "> < strong > on('initComplete', callback):</ strong > 监听初始化完成事件</ div >
262+ < div style ="margin-bottom: 8px; "> < strong > on('error', callback):</ strong > 监听错误事件</ div >
263+ </ div >
264+ </ div >
265+ </ div >
266+ </ div >
267+
168268 < div style ="text-align: center; ">
169269 < h3 style ="color: #2a2a2a; margin-bottom: 20px; font-size: 24px; ">
170270 适用场景
0 commit comments