From 44431c67804698a41aa7ae560dff96d8b7692e47 Mon Sep 17 00:00:00 2001 From: Yoone Date: Sun, 14 Dec 2025 23:30:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96.gitignore?= =?UTF-8?q?=E5=B9=B6=E8=B0=83=E6=95=B4SnowAnimator=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新.gitignore文件,简化忽略目录配置 将SnowAnimator中的system初始化移至resize函数之前,避免重复计算 添加lib/index.html作为预览页面 --- .gitignore | 4 +-- lib/index.html | 49 ++++++++++++++++++++++++++++++++ lib/src/animator/SnowAnimator.ts | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 lib/index.html diff --git a/.gitignore b/.gitignore index 211dd33..6a67cc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .DS_Store release -lib/node_modules/ -wordpress-plugin/ +node_modules +dist diff --git a/lib/index.html b/lib/index.html new file mode 100644 index 0000000..ccc5650 --- /dev/null +++ b/lib/index.html @@ -0,0 +1,49 @@ + + + + + + Yoone Snow Preview + + + + + + + diff --git a/lib/src/animator/SnowAnimator.ts b/lib/src/animator/SnowAnimator.ts index 86fa087..0433ad6 100644 --- a/lib/src/animator/SnowAnimator.ts +++ b/lib/src/animator/SnowAnimator.ts @@ -6,6 +6,7 @@ export function runSnow(canvas: HTMLCanvasElement, settings: SystemSettings){ let viewportWidth = window.innerWidth let viewportHeight = window.innerHeight const dpr = window.devicePixelRatio || 1 + const system = createSystem(context, () => viewportWidth, () => viewportHeight, settings) function resize(){ viewportWidth = window.innerWidth viewportHeight = window.innerHeight @@ -18,7 +19,6 @@ export function runSnow(canvas: HTMLCanvasElement, settings: SystemSettings){ system.recomputeTarget() } resize() - const system = createSystem(context, () => viewportWidth, () => viewportHeight, settings) const animator = new Animator( (dt) => { system.updateSystem(dt); system.renderSystem() }, () => system.shouldStop(),