SDF-2D - v0.8.0
    Preparing search index...
    • Creates a drawable rotated rectangle class with a shared color.

      Parameters

      Returns typeof RotatedRectangleBase

      A class with constructor new RotatedRectangle(center: vec2, size: vec2, rotation: number). center is the position in world coordinates; size is [width, height] in world units; rotation is the angle in radians. Pass the class's static descriptor to compile!compile, then pass instances to graphics/rendering/renderer/renderer!Renderer.addDrawable.

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

      const RotatedRectangle = RotatedRectangleFactory([1, 0.5, 0]);
      const rectangle = new RotatedRectangle([160, 120], [80, 40], Math.PI / 4);