@iconsets/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.56 kB
TypeScript
import { DefsInfo, ViewBoxInfo } 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