Applies fn to both start and end points.

import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'
// Line 10,10 -> 20,20
const line = Lines.fromNumbers(10,10, 20,20);

// Applies randomisation to both x and y.
const rand = (p) => ({
x: p.x * Math.random(),
y: p.y * Math.random()
});

// Applies our randomisation function
const line2 = apply(line, rand);
  • Parameters

    Returns Readonly<Line>