mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00

* feat: add matrix module * fix(animations): parse transform property correctly * fix(css-animations): compute transformation value with matrix * refactor: add typings for keyframes array in style scope * fix(animations): transform regex and method invocation * fix(matrix): rewrite decomposition function * refactor: transform animations parse * test: add tests for css animation transform * refactor: move transformConverter to style-properties * lint: remove unnecessary comma * lint: remove unnecessary word in d.ts * fix(style-properties): correctly use transformConverter * fix(matrix): flat multiply affine 2d matrices cc @PanayotCankov
34 lines
962 B
TypeScript
34 lines
962 B
TypeScript
const epsilon = 1E-05;
|
|
|
|
export function areClose(value1: number, value2: number): boolean {
|
|
return (Math.abs(value1 - value2) < epsilon);
|
|
}
|
|
|
|
export function greaterThanOrClose(value1: number, value2: number): boolean {
|
|
return (value1 > value2) || areClose(value1, value2);
|
|
}
|
|
|
|
export function greaterThan(value1: number, value2: number): boolean {
|
|
return (value1 > value2) && !areClose(value1, value2);
|
|
}
|
|
|
|
export function lessThan(value1: number, value2: number): boolean {
|
|
return (value1 < value2) && !areClose(value1, value2);
|
|
}
|
|
|
|
export function isZero(value: number): boolean {
|
|
return (Math.abs(value) < epsilon);
|
|
}
|
|
|
|
export function greaterThanZero(value: Object): boolean {
|
|
return (<number>value) > 0;
|
|
}
|
|
|
|
export function notNegative(value: Object): boolean {
|
|
return (<number>value) >= 0;
|
|
}
|
|
|
|
export const radiansToDegrees = (a: number) => a * (180 / Math.PI);
|
|
|
|
export const degreesToRadians = (a: number) => a * (Math.PI / 180);
|