fix: flakes

This commit is contained in:
cha0s 2020-12-14 13:52:03 -06:00
parent 84e3e8d0d6
commit c7e7aed869
2 changed files with 3 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -21,8 +21,8 @@ export default {
const baseTexture = PIXI.BaseTexture.from('/flakes.png');
await new Promise((r) => baseTexture.once('loaded', r));
const flakes = [];
for (let y = 0; y < 16; ++y) {
for (let x = 0; x < 16; ++x) {
for (let y = 0; y < 5; ++y) {
for (let x = 0; x < 5; ++x) {
const texture = new PIXI.Texture(baseTexture);
texture.frame = {
x: x * 32,
@ -60,7 +60,7 @@ export default {
const ts = ms / (1000 / slowMotion);
for (let i = 0; i < app.stage.children.length; 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.y += ts * gravity * snowflake.size;
if (snowflake.position.y >= h + 5) {