fix: flakes
This commit is contained in:
parent
84e3e8d0d6
commit
c7e7aed869
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 2.6 KiB |
|
@ -21,8 +21,8 @@ export default {
|
||||||
const baseTexture = PIXI.BaseTexture.from('/flakes.png');
|
const baseTexture = PIXI.BaseTexture.from('/flakes.png');
|
||||||
await new Promise((r) => baseTexture.once('loaded', r));
|
await new Promise((r) => baseTexture.once('loaded', r));
|
||||||
const flakes = [];
|
const flakes = [];
|
||||||
for (let y = 0; y < 16; ++y) {
|
for (let y = 0; y < 5; ++y) {
|
||||||
for (let x = 0; x < 16; ++x) {
|
for (let x = 0; x < 5; ++x) {
|
||||||
const texture = new PIXI.Texture(baseTexture);
|
const texture = new PIXI.Texture(baseTexture);
|
||||||
texture.frame = {
|
texture.frame = {
|
||||||
x: x * 32,
|
x: x * 32,
|
||||||
|
@ -60,7 +60,7 @@ export default {
|
||||||
const ts = ms / (1000 / slowMotion);
|
const ts = ms / (1000 / slowMotion);
|
||||||
for (let i = 0; i < app.stage.children.length; i++) {
|
for (let i = 0; i < app.stage.children.length; i++) {
|
||||||
const snowflake = app.stage.children[i];
|
const snowflake = app.stage.children[i];
|
||||||
snowflake.angle += (snowflake.sway - 0.5) * 2;
|
snowflake.angle += (snowflake.sway - 0.5) * 2 * Math.random();
|
||||||
snowflake.position.x += ts * snowflake.sway * Math.sin(s + snowflake.align);
|
snowflake.position.x += ts * snowflake.sway * Math.sin(s + snowflake.align);
|
||||||
snowflake.position.y += ts * gravity * snowflake.size;
|
snowflake.position.y += ts * gravity * snowflake.size;
|
||||||
if (snowflake.position.y >= h + 5) {
|
if (snowflake.position.y >= h + 5) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user