Options
All
  • Public
  • Public/Protected
  • All
Menu

A helper to draw 2D perlin maps given a perlin generator and a function

Hierarchy

  • PerlinDrawer2D

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Optional colorFcn

colorFcn: function

A color function that takes a value between [0, 255] derived from the perlin generator, and returns a color

Type declaration

    • Parameters

      • val: number

      Returns Color

generator

generator: PerlinGenerator

An existing perlin generator

Methods

draw

  • draw(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number): void
  • This draws a 2D perlin grid on a canvas context, not recommended to be called every frame due to performance

    Parameters

    • ctx: CanvasRenderingContext2D
    • x: number
    • y: number
    • width: number
    • height: number

    Returns void

image

  • image(width: number, height: number): HTMLImageElement