@three3d/effect
Version:
@three3d/effect 提供了 ThreeJS 的特效
66 lines • 2.52 kB
TypeScript
import { Curve, Vector3 } from "three";
import type { Vector2 } from "three";
/**
* 获取与 target 最近的索引
* @param sortedNums - 按照从小到大顺序数字数组
* @param target - 目标值
* @returns
*/
export declare function getClosestIndex(sortedNums: ArrayLike<number>, target: number): number;
/**
* 获取 target 附近的索引
* @param sortedNums - 按照从小到大顺序数字数组
* @param target - 目标值
* @param right - 是否获取目标值右侧的索引;
* @returns 当返回 -1 时,表示没找到
*/
export declare function getNearbyIndex(sortedNums: ArrayLike<number>, target: number, right?: boolean): number;
export type PolylinePoints<Vec extends Vector3 | Vector2 = Vector3> = Vec[];
export type PathItem<Vec extends Vector3 | Vector2 = Vector3> = Curve<Vec> | PolylinePoints<Vec> | Vec;
export type PathData<Vec extends Vector3 | Vector2 = Vector3> = PathItem<Vec>[];
/**
* 路径数据转连续曲线
* @remarks
* 保证转换后的所有曲线段是首尾相接的
* @param pathData
* @returns
*/
export declare function pathDataToContinuousCurves<Vec extends Vector3 | Vector2>(pathData: PathData<Vec>): Curve<Vec>[];
/**
* 路径数据转曲线
* @remarks
* 只是将 pathData 中所描述的曲线段数据转成对应的曲线;
* 不保证转换后的所有曲线段是首尾相接的;
* @param pathData
* @returns
*/
export declare function pathDataToCurves<Vec extends Vector3 | Vector2>(pathData: PathData<Vec>): Curve<Vec>[];
/**
* pathItem 转 曲线
* @param item
* @param lastPoint
* @param continuous - 是否生成连续的曲线;如果是,则会连接 lastPoint 和 曲线开始点
* @returns
*/
export declare function pathItemToCurves<Vec extends Vector3 | Vector2>(item: PathItem<Vec>, lastPoint?: Vec | null, continuous?: boolean): Curve<Vec>[];
/**
* pathItem 转 曲线
* @param item
* @param lastPoint
* @param continuous - 是否生成连续的曲线;如果是,则会连接 lastPoint 和 曲线开始点
* @returns
*/
export declare function pathItemToCurve<Vec extends Vector3 | Vector2>(item: PathItem<Vec>, lastPoint?: Vec | null, continuous?: boolean): Curve<Vec> | null;
/**
* 获取 PathItem 的起始点
* @param pathData
* @returns
*/
export declare function getPathItemStartPoint(pathItem: PathItem): Vector3;
/**
* 获取 PathItem 的终点
* @param pathData
* @returns
*/
export declare function getPathItemEndPoint(pathItem: PathItem): Vector3;
//# sourceMappingURL=tools.d.ts.map