@ debuffjp/ juice (英语)
游戏画面的构件是: 松动、松动、集合粒子、小径和壁球和地铁。 没有依赖关系,每个出口都可以自行使用.
import { Particles, squash, Tweens } from "@debuffjp/juice";
const tweens = new Tweens();
const particles = new Particles(() => game.random.next()); // seeded, so captures are reproducible
// on impact
squash(tweens, player, 0.35);
particles.emit({ x, y, count: 16, colors: ["#ffd166", "#ef476f"], gravity: 200 });
game.camera.shake(0.3);
game.freeze(0.06); // hit-stop
// every step
tweens.update(dt);
particles.update(dt);
API 密码
Tweens数字 :to(target, props, { duration, ease, delay, yoyo, repeat, onComplete })→{ done, cancel(), finished }, (中文(简体) ),kill(target), (中文(简体) ),update(dt)ease数字 :linear, (中文(简体) ),in/out/inOutQuad, (中文(简体) ),in/out/inOutCubic, (中文(简体) ),outBack, (中文(简体) ),outElastic, (中文(简体) ),outBounceParticles数字 :emit({ x, y, count, speed, angle, spread, life, size, sizeEnd, colors, gravity, drag, shape, additive }), (中文(简体) ),update(dt), (中文(简体) ),draw(draw), (中文(简体) ),clear()Trail数字 :push(x, y), (中文(简体) ),draw(draw), (中文(简体) ),clear()squash(tweens, target, amount?, duration?): 只替换显示在target因此,移动或淡出 它不断运行。 在0.8之前,它阻止了目标上的每一圈.