Skip to content

Commit

Permalink
Simplify rx, ry logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ts5h committed Sep 30, 2023
1 parent 94a9414 commit 50b8674
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/components/BiasedDiamondRing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 50,9 @@ export const BiasedDiamondRing: FC = () => {
const cx = windowSize.width / 2;
const cy = windowSize.height / 2;

const r = Math.min(windowSize.width, windowSize.height) / 2;
let rx = r Math.random() * 400 - 200;
let ry = r Math.random() * 400 - 200;

if (rx > Math.min(windowSize.width, windowSize.height) / 2) {
rx =
Math.min(windowSize.width, windowSize.height) / 2 -
(isMobile ? 10 : 20);
}

if (ry > Math.min(windowSize.width, windowSize.height) / 2) {
ry =
Math.min(windowSize.width, windowSize.height) / 2 -
(isMobile ? 10 : 20);
}
const rx =
Math.min(windowSize.width, windowSize.height) / 2;
const ry = Math.random() * (rx * 0.8) rx * 0.2;

const rotDeg = Math.random() * 360;
const rotRad = getRad(rotDeg);
Expand Down

0 comments on commit 50b8674

Please sign in to comment.