UNPKG

svg-morpheus-ts

Version:

ESM TypeScript library enabling SVG icons to morph from one to the other. It implements Material Design's Delightful Details transitions. Refactored with modern TypeScript + Vite + pnpm stack. Supports both Chinese and English documentation.

47 lines (46 loc) 1.55 kB
import { ViewBoxInfo, DefsInfo } from './types'; /** * 坐标转换矩阵 */ export interface TransformMatrix { /** Scale X | X轴缩放 */ scaleX: number; /** Scale Y | Y轴缩放 */ scaleY: number; /** Translate X | X轴平移 */ translateX: number; /** Translate Y | Y轴平移 */ translateY: number; } /** * 解析ViewBox字符串 */ export declare function parseViewBox(viewBoxStr: string): ViewBoxInfo; /** * 计算从源ViewBox到目标ViewBox的转换矩阵 */ export declare function calculateTransformMatrix(fromViewBox: ViewBoxInfo, toViewBox: ViewBoxInfo): TransformMatrix; /** * 应用转换矩阵到点坐标 */ export declare function transformPoint(x: number, y: number, matrix: TransformMatrix): [number, number]; /** * 转换SVG路径数据 */ export declare function transformPath(pathData: string, matrix: TransformMatrix): string; /** * 根据起始和目标ViewBox计算最佳的过渡ViewBox */ export declare function calculateOptimalViewBox(fromViewBox: ViewBoxInfo | undefined, toViewBox: ViewBoxInfo | undefined): ViewBoxInfo; /** * 转换渐变定义中的坐标 */ export declare function transformGradientDefs(defs: DefsInfo, idPrefix?: string, transformMatrix?: TransformMatrix): DefsInfo; /** * 更新路径中的defs引用 */ export declare function updateDefsReferences(pathData: string, attrs: Record<string, any>, oldToNewIdMap: Record<string, string>): { pathData: string; attrs: Record<string, any>; }; //# sourceMappingURL=coordinate-transform.d.ts.map