SDF-2D - v0.8.0
    Preparing search index...
    • Creates a drawable polygon class with a noisy outline and a shared color.

      Providing a noiseTexture in graphics/rendering/settings/runtime-settings!RuntimeSettings.textures is required for this drawable. A noise texture can be generated with graphics/rendering/renderer/noise-renderer!renderNoise.

      Parameters

      Returns typeof PolygonBase & NoisyPolygonBase

      A class with constructor new NoisyPolygon(vertices: Array<vec2>). vertices contains between one and vertexCount positions in world coordinates, ordered around the polygon's outline. Instances also have a randomOffset property (default 0) for varying the sampled noise. Pass the class's static descriptor to compile!compile, then pass instances to graphics/rendering/renderer/renderer!Renderer.addDrawable.

      import { NoisyPolygonFactory } from 'sdf-2d';

      const NoisyPolygon = NoisyPolygonFactory(3, [1, 0.5, 0]);
      const polygon = new NoisyPolygon([[100, 100], [200, 100], [150, 180]]);