Skip to content

SvgTransformOrder interface ​

An order of applySvgTransforms, created by svgRotateBy, svgRotateTo, svgFlipTo, svgScaleBy, svgTranslateBy or svgPlaceOn: keep it to change its values later with set.

ts
import type { SvgTransformOrder } from 'utils';

Signature ​

ts
export interface SvgTransformOrder<TArguments extends unknown[]> {
  /** Changes the values of the order; once applied, its own transform is updated. */
  set(...args: TArguments): void;

Parameters ​

NameDescription
TArgumentsThe values of the order, the same as the arguments of its function.

Tests ​

Line coverage: 0 %.

Source ​

src/svg-transform/svg-transform-order.ts (on GitHub)

Used by ​

  • applySvgTransforms: Applies orders to an SVG element, in order, each on what the previous ones give: one transform per order is added at the end of its transform list.
  • svgFlipTo: An order of applySvgTransforms that makes the element mirrored or not, as seen on screen, around one of its anchors: svgFlipTo(false) makes a mirrored text readable again.
  • svgPlaceOn: An order of applySvgTransforms that moves the element so that one of its anchors lands on an anchor of another element, as seen on screen, whatever groups each one is in.
  • svgRotateBy: An order of applySvgTransforms that turns the element by an angle from its position before this order, clockwise on screen, around an anchor of itself or of another element: set(90) after set(3) gives 90° from the start, not 93°.
  • svgRotateTo: An order of applySvgTransforms that turns the element to an absolute angle on screen, clockwise from upright, around an anchor of itself or of another element: svgRotateTo(0) straightens it.
  • svgScaleBy: An order of applySvgTransforms that enlarges or shrinks the element in its own axes, around an anchor of its drawing, which gives the direction: with 'left', it grows to the right; with 'bottom', upwards.
  • svgTranslateBy: An order of applySvgTransforms that moves the element along its own axes, in its own units: turned by 90°, "to the right" goes down on screen.
Source code
ts
/**
 * An order of `applySvgTransforms`, created by `svgRotateBy`, `svgRotateTo`, `svgFlipTo`, `svgScaleBy`,
 * `svgTranslateBy` or `svgPlaceOn`: keep it to change its values later with `set`.
 *
 * @template TArguments - The values of the order, the same as the arguments of its function.
 */
export interface SvgTransformOrder<TArguments extends unknown[]> {
  /** Changes the values of the order; once applied, its own transform is updated. */
  set(...args: TArguments): void;
}

Keywords: svg, transform, order, svg transforms, interface

Generated from the JSDoc of the sources.