Introduction to Solandra

Solandra is a TypeScript library for generative art. It provides shapes, curves, seeded randomness and loops that work in canvas coordinates.

This example draws stars at random points, using Poisson disk sampling to keep them apart.

Set the background and fill colours, then draw a star at each point:

s.background(210, 70, 10)
s.setFillColor(30, 60, 70)
s.forPoissonDiskPoints({ minDist: 0.1 }, (at) => {
  s.fill(new Star({ at, r: 0.025, n: 5, a: s.randomAngle() }))
})

To vary the stars, choose a new colour and radius inside the loop. The fill colour stays in effect until you change it.

s.background(210, 70, 10)
s.forPoissonDiskPoints({ minDist: 0.1 }, (at) => {
  s.setFillColor(s.uniformRandomInt({ from: 10, to: 50 }), 60, 60)
  s.fill(
    new Star({
      at,
      r: 0.025 + 0.025 * s.random(),
      n: 5,
      a: s.randomAngle(),
    })
  )
})

Solandra was made by James Porter.

Check out the GitHub page or install with npm i solandra