From b31afca4b1dbf2e41694ab8028f371cab5af14a5 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Tue, 1 Aug 2023 13:02:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=A2=8E=E8=A3=82=E7=89=B9?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- idea.md | 2 +- src/plugin/fx/frag.ts | 12 ++++++------ src/plugin/game/enemy/battle.ts | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/idea.md b/idea.md index 9fb9b29..6224dfa 100644 --- a/idea.md +++ b/idea.md @@ -75,5 +75,5 @@ dam4.png ---- 存档 59 [] 优化开头动画 [] 玩家可以设置字体大小 [] 完全删除 functions.js -[] 优化插件加载系统 +[x] 优化插件加载系统 [] 优化 Scroll 组件 diff --git a/src/plugin/fx/frag.ts b/src/plugin/fx/frag.ts index f7d6b68..0582ef8 100644 --- a/src/plugin/fx/frag.ts +++ b/src/plugin/fx/frag.ts @@ -1,4 +1,4 @@ -import { Animation, bezier, sleep } from 'mutate-animate'; +import { Animation, linear, sleep } from 'mutate-animate'; interface SplittedImage { canvas: HTMLCanvasElement; @@ -17,11 +17,11 @@ interface FraggingImage extends SplittedImage { /** 最大移动距离,最终位置距离中心的距离变成原来的几倍 */ const MAX_MOVE_LENGTH = 1.15; /** 移动距离波动,在最大移动距离的基础上加上多少倍距离的波动距离 */ -const MOVE_FLUSH = 0.2; +const MOVE_FLUSH = 0.7; /** 最大旋转角,单位是弧度 */ -const MAX_ROTATE = 0.4; +const MAX_ROTATE = 0.5; /** 碎裂动画的速率曲线函数 */ -const FRAG_TIMING = bezier(0.75); +const FRAG_TIMING = linear(); export default function init() { return { applyFragWith }; @@ -30,7 +30,7 @@ export default function init() { export function applyFragWith( canvas: HTMLCanvasElement, length: number = 4, - time: number = 4000 + time: number = 1000 ) { // 先切分图片 const imgs = splitCanvas(canvas, length); @@ -44,7 +44,7 @@ export function applyFragWith( const centerY = v.y + v.canvas.height / 2; const onX = centerX === cx; const onY = centerY === cy; - const rate = MAX_MOVE_LENGTH - 1 + Math.random() * MOVE_FLUSH; + const rate = MAX_MOVE_LENGTH - 1 + Math.random() ** 3 * MOVE_FLUSH; let endX = onY ? 0 : (centerX - cx) * rate; let endY = onX ? 0 : (centerY - cy) * rate; const mx = Math.abs(endX + centerX) + Math.abs(v.canvas.width); diff --git a/src/plugin/game/enemy/battle.ts b/src/plugin/game/enemy/battle.ts index 45d4025..a5875ee 100644 --- a/src/plugin/game/enemy/battle.ts +++ b/src/plugin/game/enemy/battle.ts @@ -206,6 +206,7 @@ core.events.afterBattle = function ( frag.style.top = `${top}px`; frag.style.zIndex = '45'; frag.style.position = 'absolute'; + frag.style.filter = 'sepia(20%)brightness(120%)'; core.dom.gameDraw.appendChild(frag); manager.onEnd.then(() => { frag.remove();