utils
import {...} from "@motion-canvas/2d/lib/utils";
Functions
adjustRectRadius
public adjustRectRadiusradius: numberhorizontal: numbervertical: numberrect: BBox: number
Parameters
radius: number
horizontal: number
vertical: number
rect: BBox
arc
public arccontext: CanvasRenderingContext2DPath2Dcenter: Vector2radius: numberstartAngle: number = 0endAngle: number = ...counterclockwise: boolean = false: void
Parameters
context: CanvasRenderingContext2DPath2D
center: Vector2
radius: number
startAngle: number = 0
endAngle: number = ...
counterclockwise: boolean = false
arcTo
Parameters
bezierCurveTo
public bezierCurveTocontext: CanvasRenderingContext2DPath2DcontrolPoint1: Vector2controlPoint2: Vector2to: Vector2: void
Parameters
canvasStyleParser
public canvasStyleParserstyle: PossibleCanvasStyle: nullGradientPatternColor
Parameters
drawImage
public drawImagecontext: CanvasRenderingContext2Dimage: CanvasImageSourcedestination: BBox: void
public drawImagecontext: CanvasRenderingContext2Dimage: CanvasImageSourcesource: BBoxdestination: BBox: void
Parameters
drawLine
public drawLinecontext: CanvasRenderingContext2DPath2Dpoints: Vector2[]: void
Parameters
drawPivot
Parameters
drawPolygon
Parameters
drawRect
public drawRectcontext: CanvasRenderingContext2DPath2Drect: BBox: void
Parameters
drawRoundRect
public drawRoundRectcontext: CanvasRenderingContext2DPath2Drect: BBoxradius: SpacingsmoothCorners: booleancornerSharpness: number: void
Parameters
context: CanvasRenderingContext2DPath2D
rect: BBox
radius: Spacing
smoothCorners: boolean
cornerSharpness: number
fillRect
public fillRectcontext: CanvasRenderingContext2Drect: BBox: void
Parameters
is
Create a predicate that checks if the given object is an instance of the given class.
Type Parameters
Parameters
klass: ()
The class to check against.
lineTo
public lineTocontext: CanvasRenderingContext2DPath2Dposition: Vector2: void
Parameters
moveTo
public moveTocontext: CanvasRenderingContext2DPath2Dposition: Vector2: void
Parameters
quadraticCurveTo
public quadraticCurveTocontext: CanvasRenderingContext2DPath2DcontrolPoint: Vector2to: Vector2: void
Parameters
resolveCanvasStyle
public resolveCanvasStylestyle: CanvasStylecontext: CanvasRenderingContext2D: stringCanvasGradientCanvasPattern
Parameters
strokeRect
public strokeRectcontext: CanvasRenderingContext2Drect: BBox: void
Parameters
withDefaults
Create a higher order component with default props.
Examples
Type Parameters
T extends FunctionComponentanyNodeConstructoranyNode