Skip to main content

partials

import {...} from "@canvas-commons/2d/lib/partials";

Classes​

Interfaces​

Type Aliases​

CanvasRepetition​

type CanvasRepetition = null'repeat''repeat-x''repeat-y''no-repeat'

CanvasStyle​

type CanvasStyle = nullColorGradientPattern

DesiredLength​

type DesiredLength = Lengthnull

Represents a desired length used internally by layout Nodes.

When the desired length is set to null it represents a default value for whatever property it describes.


FlexBasis​

type FlexBasis = Lengthnull

FlexContent​

type FlexContent = 'normal''center''start''end''space-between''space-around''space-evenly''stretch'

FlexDirection​

type FlexDirection = 'row''row-reverse''column''column-reverse'

FlexItems​

type FlexItems = 'auto''center''start''end''stretch''baseline'

FlexWrap​

type FlexWrap = 'nowrap''wrap''wrap-reverse'

GradientType​

type GradientType = 'linear''conic''radial'

LayoutMode​

type LayoutMode = booleannull

Length​

type Length = number`${number}%`

Represents a length used by most layout properties.

The value can be either:

  • number - the desired length in pixels
  • ${number}% - a string with the desired length in percents, for example '50%'

LengthLimit​

type LengthLimit = Lengthnull

Represents a length limit used by layout properties such as max-width.


PartialRoughConfig​

type PartialRoughConfig = PartialRoughConfig

Partial rough configuration with defaults applied.


PossibleCanvasStyle​

type PossibleCanvasStyle = nullPossibleColorGradientPattern

RoughFillStyle​

type RoughFillStyle = 'hachure''solid''zigzag''cross-hatch''dots''dashed''zigzag-line'

Fill style options for rough shapes.

  • hachure: Parallel lines filling the shape (default)
  • solid: Solid fill with slight irregularity
  • zigzag: Zigzag pattern filling
  • cross-hatch: Crossed parallel lines
  • dots: Dotted pattern filling
  • dashed: Dashed lines filling
  • zigzag-line: Zigzag lines filling

TextAlign​

type TextAlign = CanvasTextAlign'justify'

Line-level text alignment. Extends CanvasTextAlign with 'justify', which distributes line-end slack across word gaps. Justification only affects non-last lines of a paragraph; the last line falls back to the start orientation.


TextExclusion​

type TextExclusion = TextShapeExclusionhorizontalPadding?: numberkind: 'node'node: SignalValueNodeverticalPadding?: number

A region of a <Txt> block that text wraps around. Coordinates are Txt-local and center-origin, the same space every other node uses. A node exclusion instead reads its shape from a live Node.


TextShapeExclusion​

type TextShapeExclusion = height: numberhorizontalPadding?: numberkind: 'rect'verticalPadding?: numberwidth: numberx: numbery: numberhorizontalPadding?: numberkind: 'polygon'points: x: numbery: number[]verticalPadding?: number

A region of a <Txt> block that text wraps around, given by its own geometry. A rect's x/y is its center and polygon points sit in the same space.


TextWrap​

type TextWrap = boolean'pre'

VerticalAlign​

type VerticalAlign = 'top''middle''bottom'

Vertical placement of text when the rendered text block is shorter than the configured height. 'top' (default) aligns to the top edge, 'middle' centers, 'bottom' aligns to the bottom edge.


WordBreak​

type WordBreak = 'normal''keep-all'

Functions​

blur​

public blurvalue?: SignalValuenumber: Filter

Create a blur filter.

Parameters


brightness​

public brightnessvalue?: SignalValuenumber: Filter

Create a brightness filter.

Parameters


contrast​

public contrastvalue?: SignalValuenumber: Filter

Create a contrast filter.

Parameters


getDefaultRoughConfig​

public getDefaultRoughConfig(): RoughConfig

Get default rough configuration.


grayscale​

public grayscalevalue?: SignalValuenumber: Filter

Create a grayscale filter.

Parameters


hue​

public huevalue?: SignalValuenumber: Filter

Create a hue filter.

Parameters


invert​

public invertvalue?: SignalValuenumber: Filter

Create an invert filter.

Parameters


mergeRoughConfig​

public mergeRoughConfigconfig: PartialRoughConfig: RoughConfig

Merge partial rough configuration with defaults.

Parameters

  • config: PartialRoughConfig

    Partial configuration to merge


saturate​

public saturatevalue?: SignalValuenumber: Filter

Create a saturate filter.

Parameters


sepia​

public sepiavalue?: SignalValuenumber: Filter

Create a sepia filter.

Parameters