update code and styles
This commit is contained in:
@@ -102,14 +102,15 @@ export default function IndustryWorldMap() {
|
||||
buildDots();
|
||||
};
|
||||
|
||||
const cityPx = () => CITIES.map(([cx, cy]) => ({ x: cx * w, y: cy * h }));
|
||||
type Point = { x: number; y: number };
|
||||
const cityPx = (): Point[] => CITIES.map(([cx, cy]) => ({ x: cx * w, y: cy * h }));
|
||||
|
||||
const ctrl = (p0: { x: number; y: number }, p1: { x: number; y: number }) => {
|
||||
const ctrl = (p0: Point, p1: Point): Point => {
|
||||
const mx = (p0.x + p1.x) / 2, my = (p0.y + p1.y) / 2;
|
||||
const lift = Math.hypot(p1.x - p0.x, p1.y - p0.y) * 0.28;
|
||||
return { x: mx, y: my - lift };
|
||||
};
|
||||
const bezier = (p0: any, c: any, p1: any, t: number) => {
|
||||
const bezier = (p0: Point, c: Point, p1: Point, t: number): Point => {
|
||||
const u = 1 - t;
|
||||
return {
|
||||
x: u * u * p0.x + 2 * u * t * c.x + t * t * p1.x,
|
||||
|
||||
Reference in New Issue
Block a user