• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { float64 } from "#koalaui/compat";
17/**
18 * Computes the linear interpolation between `source` and `target` based on `weight`.
19 *
20 * @param weight - interpolation factor in the range [0..1]
21 * @param source - a value corresponding to weight 0
22 * @param target - a value corresponding to weight 1
23 * @returns interpolated value
24 */
25export declare function lerp(weight: float64, source: float64, target: float64): float64;
26/**
27 * Clamps a {@link value} within the specified range.
28 *
29 * @param value - a value to clamp
30 * @param min - the lower boundary of the range
31 * @param max - the upper boundary of the range
32 * @returns `min` if `value` is less than `min`,
33 *          `max` if `value` is greater than `max`,
34 *          `value` otherwise
35 */
36export declare function clamp(value: float64, min: float64, max: float64): float64;
37/**
38 * Calculates the difference between the argument and
39 * the largest (closest to positive infinity) integer value
40 * that is less than or equal to the argument.
41 *
42 * @param value a floating-point value to process
43 * @returns a floor modulus of the given value in the range [0..1)
44 */
45export declare function modulo(value: float64): float64;
46/**
47 * @param str a string to parse
48 * @param name a name for error message
49 * @param verify whether to verify parsing validity
50 * @returns a floating-point number
51 * @throws Error if `str` cannot be parsed
52 */
53export declare function parseNumber(str: string, name?: string, verify?: boolean): float64;
54/**
55 * An ArkTS-compliant replacement for {@link isFinite}.
56 */
57export declare function isFiniteNumber(number: float64): boolean;
58export declare function getDistancePx(startX: float64, startY: float64, endX: float64, endY: float64): float64;
59//# sourceMappingURL=math.d.ts.map