UNPKG

jparticles

Version:

A lightweight, efficient and easy-to-use Canvas library for building some cool particle effects.

35 lines (34 loc) 1.07 kB
import Base from "./base"; import type { CommonConfig } from "../types/common-config"; import type { ICanvasImageSource, ValueOf } from "../types/utility-types"; declare const validShapeTypes: readonly ["circle", "triangle", "star", "image"]; export declare type NormalShapeType = Exclude<ValueOf<typeof validShapeTypes>, 'image'>; export declare type ShapeType = NormalShapeType | string | ICanvasImageSource; export interface ShapeData { type: ValueOf<typeof validShapeTypes>; source?: ICanvasImageSource; isImageLoaded?: boolean; sides?: number; dent?: number; } export default abstract class Shape<Options> extends Base<Options> { protected readonly options: Options & CommonConfig & { shape?: ShapeType | ShapeType[]; }; /** * 获取形状数据 */ protected getShapeData(): ShapeData; /** * 绘制形状 */ protected drawShape(data: { x: number; y: number; r: number; color: string; shape: ShapeData; rotate: number; }): void; } export {};