Skip to content

Commit

Permalink
chore: rain package update radius and angle
Browse files Browse the repository at this point in the history
  • Loading branch information
peterparkernho committed Feb 3, 2024
1 parent ad25d31 commit bbe7737
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/PublicSale/luckyMoney/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function LuckyMoney() {
let canvasContext: CanvasRenderingContext2D | null = null;

const envelop = ENVELOPS[Math.floor(Math.random() * 7)];
const angles = Array.from(Array(10)).map(() => Math.random() * 0.1);
const radiusRandom = Array.from(Array(10)).map(() => Math.random() * 10);

function clearWindow() {
canvasContext?.clearRect(0, 0, width, height);
Expand All @@ -80,8 +82,8 @@ function LuckyMoney() {

money.currentFrame += 1;
money.y += money.speed;
money.angle += money.direction * 0.05;
const radius = money.direction * (5 + (index % 6));
money.angle += money.direction * angles[index];
const radius = money.direction * (radiusRandom[index] + (index % 6));
money.x +=
Math.sin((money.currentFrame + index) / (2 * Math.PI)) * radius;
});
Expand Down

0 comments on commit bbe7737

Please sign in to comment.