How to use the d3-random.randomNormal.source function in d3-random

To help you get started, we’ve selected a few d3-random examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rolyatmax / sketches / src / rhadamanthine-cartload.js View on Github external
ctx.setup = ctx.resize = function () {
  rand = new Alea(settings.seed)
  simplex = new SimplexNoise(rand)
  randNormal = randomNormal.source(rand)
  clear(ctx, `rgba(${settings.backgroundColor.join(',')}, 0)`)
  clear(watercolorCtx, `rgb(${settings.backgroundColor.join(',')})`)
  setupBackground(watercolorCtx)

  // add boxes and stuff
  createBoxes(settings.boxCount).forEach((box) => {
    ctx.save()
    ctx.translate(box.center[0], box.center[1])
    ctx.rotate(box.rotation)
    drawRect(ctx, [0, 0], box.width, box.height, 'rgba(250, 250, 250, 0.6)')
    ctx.restore()
  })

  // addVignette(ctx)
  addVignette(watercolorCtx)
}
github rolyatmax / sketches / src / antic-grandmom.js View on Github external
ctx.setup = ctx.resize = function () {
  center = [ctx.width / 2, ctx.height / 2]
  ctx.clearRect(0, 0, ctx.width, ctx.height)
  rand = new Alea(settings.seed)
  randX = randomNormal.source(rand)(center[0], settings.sigma)
  randY = randomNormal.source(rand)(center[1], settings.sigma)
  simplex = new SimplexNoise(rand)
  lines = []
  clearTimeout(token)
  token = setTimeout(createLine, 0)
}