@nmmty/lazycanvas
Version:
A simple way to interact with @napi-rs/canvas in an advanced way!
41 lines (40 loc) • 2.02 kB
TypeScript
import { BaseLayer } from "./BaseLayer";
import { IMorphLayer, IMorphLayerProps, ColorType, ScaleType } from "../../types";
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
import { LayersManager } from "../managers/LayersManager";
export declare class MorphLayer extends BaseLayer<IMorphLayerProps> {
props: IMorphLayerProps;
constructor(props?: IMorphLayerProps);
/**
* @description Sets size of the morph layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
* @param width {ScaleType} - The `width` of the morph layer.
* @param height {ScaleType} - The `height` of the morph layer.
* @param radius {ScaleType} - The `radius` of the morph layer. (optional)
*/
setSize(width: ScaleType, height: ScaleType, radius?: ScaleType): this;
/**
* @description Sets the color of the layer. You can use `hex`, `rgb`, `rgba`, `hsl`, `hsla`, and `Gradient`color.
* @param color {string} - The `color` of the layer.
*/
setColor(color: ColorType): this;
/**
* @description Sets the stroke of the layer.
* @param width {number} - The `width` of the stroke.
* @param cap {string} - The `cap` of the stroke.
* @param join {string} - The `join` of the stroke.
* @param dash {number[]} - The `dash` of the stroke.
* @param dashOffset {number} - The `dashOffset` of the stroke.
* @param miterLimit {number} - The `miterLimit` of the stroke.
*/
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
/**
* @description Sets the fills of the layer. If `true` the layer will be filled, if `false` the layer will be stroked.
* @param filled {boolean} - The `filled` of the layer.
*/
setFilled(filled: boolean): this;
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
/**
* @returns {IMorphLayer}
*/
toJSON(): IMorphLayer;
}