Compare commits

..

3 Commits

Author SHA1 Message Date
Yoone 44a2ee66f0 chore: 删除不再使用的雪景特效相关资源文件 2025-12-14 23:32:31 +08:00
Yoone b07307b365 chore 2025-12-14 23:31:18 +08:00
Yoone 44431c6780 refactor: 优化.gitignore并调整SnowAnimator初始化顺序
更新.gitignore文件,简化忽略目录配置
将SnowAnimator中的system初始化移至resize函数之前,避免重复计算
添加lib/index.html作为预览页面
2025-12-14 23:30:35 +08:00
13 changed files with 52 additions and 13 deletions

4
.gitignore vendored
View File

@ -1,4 +1,4 @@
.DS_Store .DS_Store
release release
lib/node_modules/ node_modules
wordpress-plugin/ dist

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.2 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 11 KiB

1
dist/index.js vendored
View File

@ -1 +0,0 @@
import{r as a}from"./assets/SnowAnimator-Dem4j_A7.js";function i(){const t=document.getElementById("effectiveAppsSnow");if(!t)return;if(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.style.display="none";return}const e=window.YooneSnowSettings||{},n={selectedShapes:Array.isArray(e.selectedShapes)?e.selectedShapes:[],mediaItems:Array.isArray(e.mediaItems)?e.mediaItems:[],emojiItems:Array.isArray(e.emojiItems)?e.emojiItems:[],textItems:Array.isArray(e.textItems)?e.textItems:[],shapeWeights:e.shapeWeights||{},mediaWeights:e.mediaWeights||{},emojiWeights:e.emojiWeights||{},textWeights:e.textWeights||{},radiusMin:typeof e.radiusMin=="number"?e.radiusMin:1,radiusMax:typeof e.radiusMax=="number"?e.radiusMax:3,driftMin:typeof e.driftMin=="number"?e.driftMin:.4,driftMax:typeof e.driftMax=="number"?e.driftMax:1,swingMin:typeof e.swingMin=="number"?e.swingMin:.2,swingMax:typeof e.swingMax=="number"?e.swingMax:1,displayDurationSeconds:typeof e.displayDurationSeconds=="number"?e.displayDurationSeconds:0,maxCount:typeof e.maxCount=="number"?e.maxCount:0,maxCountSmall:typeof e.maxCountSmall=="number"?e.maxCountSmall:0,maxCountMedium:typeof e.maxCountMedium=="number"?e.maxCountMedium:0,maxCountLarge:typeof e.maxCountLarge=="number"?e.maxCountLarge:0,assetsMap:e.assetsMap||{}};a(t,n)}document.readyState==="complete"?i():window.addEventListener("load",i);

1
dist/snow.css vendored
View File

@ -1 +0,0 @@
#effectiveAppsSnow{display:block;position:fixed;top:0;left:0;right:0;bottom:0;pointer-events:none;z-index:1000}

1
dist/snow.js vendored
View File

@ -1 +0,0 @@
import{r as a}from"./assets/SnowAnimator-Dem4j_A7.js";function i(){const t=document.getElementById("effectiveAppsSnow");if(!t)return;if(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.style.display="none";return}const e=window.YooneSnowSettings||{},n={selectedShapes:Array.isArray(e.selectedShapes)?e.selectedShapes:[],mediaItems:Array.isArray(e.mediaItems)?e.mediaItems:[],emojiItems:Array.isArray(e.emojiItems)?e.emojiItems:[],textItems:Array.isArray(e.textItems)?e.textItems:[],shapeWeights:e.shapeWeights||{},mediaWeights:e.mediaWeights||{},emojiWeights:e.emojiWeights||{},textWeights:e.textWeights||{},radiusMin:typeof e.radiusMin=="number"?e.radiusMin:1,radiusMax:typeof e.radiusMax=="number"?e.radiusMax:3,driftMin:typeof e.driftMin=="number"?e.driftMin:.4,driftMax:typeof e.driftMax=="number"?e.driftMax:1,swingMin:typeof e.swingMin=="number"?e.swingMin:.2,swingMax:typeof e.swingMax=="number"?e.swingMax:1,displayDurationSeconds:typeof e.displayDurationSeconds=="number"?e.displayDurationSeconds:0,maxCount:typeof e.maxCount=="number"?e.maxCount:0,maxCountSmall:typeof e.maxCountSmall=="number"?e.maxCountSmall:0,maxCountMedium:typeof e.maxCountMedium=="number"?e.maxCountMedium:0,maxCountLarge:typeof e.maxCountLarge=="number"?e.maxCountLarge:0,assetsMap:e.assetsMap||{}};a(t,n)}document.readyState==="complete"?i():window.addEventListener("load",i);

49
lib/index.html Normal file
View File

@ -0,0 +1,49 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Yoone Snow Preview</title>
</head>
<body style="margin:0;padding:0;">
<canvas id="effectiveAppsSnow" aria-hidden="true"></canvas>
<script type="module">
import santa_hat from '/src/assets/圣诞雪帽.svg'
import candy_cane from '/src/assets/圣诞拐杖.svg'
import christmas_sock from '/src/assets/圣诞袜子.svg'
import christmas_tree from '/src/assets/圣诞树.svg'
import reindeer from '/src/assets/圣诞麋鹿.svg'
import christmas_berry from '/src/assets/圣诞果.svg'
window.YooneSnowSettings = {
selectedShapes: ['dot','flake','yuanbao','coin','santa_hat','candy_cane','christmas_sock','christmas_tree','reindeer','christmas_berry'],
mediaItems: [],
emojiItems: [],
textItems: [],
shapeWeights: { dot:1, flake:4, yuanbao:1, coin:1, santa_hat:1, candy_cane:1, christmas_sock:1, christmas_tree:1, reindeer:1, christmas_berry:1 },
mediaWeights: {},
emojiWeights: {},
textWeights: {},
radiusMin: 1.0,
radiusMax: 3.0,
driftMin: 0.4,
driftMax: 1.0,
swingMin: 0.2,
swingMax: 1.0,
displayDurationSeconds: 0,
maxCount: 0,
maxCountSmall: 0,
maxCountMedium: 0,
maxCountLarge: 0,
assetsMap: {
santa_hat,
candy_cane,
christmas_sock,
christmas_tree,
reindeer,
christmas_berry
}
}
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@ -6,6 +6,7 @@ export function runSnow(canvas: HTMLCanvasElement, settings: SystemSettings){
let viewportWidth = window.innerWidth let viewportWidth = window.innerWidth
let viewportHeight = window.innerHeight let viewportHeight = window.innerHeight
const dpr = window.devicePixelRatio || 1 const dpr = window.devicePixelRatio || 1
const system = createSystem(context, () => viewportWidth, () => viewportHeight, settings)
function resize(){ function resize(){
viewportWidth = window.innerWidth viewportWidth = window.innerWidth
viewportHeight = window.innerHeight viewportHeight = window.innerHeight
@ -18,7 +19,6 @@ export function runSnow(canvas: HTMLCanvasElement, settings: SystemSettings){
system.recomputeTarget() system.recomputeTarget()
} }
resize() resize()
const system = createSystem(context, () => viewportWidth, () => viewportHeight, settings)
const animator = new Animator( const animator = new Animator(
(dt) => { system.updateSystem(dt); system.renderSystem() }, (dt) => { system.updateSystem(dt); system.renderSystem() },
() => system.shouldStop(), () => system.shouldStop(),