@galacean/effects-plugin-orientation-transformer 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/composition-transformer-acceler.d.ts +29 -0
- package/dist/device-orientation.d.ts +64 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +802 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +9 -0
- package/dist/index.min.js.map +1 -0
- package/dist/index.mjs +794 -0
- package/dist/index.mjs.map +1 -0
- package/dist/orientation-adapter-acceler.d.ts +24 -0
- package/dist/orientation-plugin-loader.d.ts +23 -0
- package/dist/transform-item.d.ts +2 -0
- package/dist/transform-vfx-item.d.ts +10 -0
- package/dist/utils/angle-limit.d.ts +18 -0
- package/dist/utils/deep-merge.d.ts +1 -0
- package/dist/utils/device.d.ts +1 -0
- package/dist/utils/filtering.d.ts +40 -0
- package/dist/utils/object-type.d.ts +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Composition } from '@galacean/effects';
|
|
2
|
+
export interface CompositionTransformerTarget {
|
|
3
|
+
name: string;
|
|
4
|
+
xMin: number;
|
|
5
|
+
xMax: number;
|
|
6
|
+
yMin: number;
|
|
7
|
+
yMax: number;
|
|
8
|
+
}
|
|
9
|
+
type EventType = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
export declare class CompositionTransformerAcceler {
|
|
14
|
+
private readonly composition;
|
|
15
|
+
private readonly targets;
|
|
16
|
+
private readonly records;
|
|
17
|
+
private readonly current;
|
|
18
|
+
private gammaRange;
|
|
19
|
+
private betaRange;
|
|
20
|
+
private currentEvent?;
|
|
21
|
+
constructor(composition: Composition);
|
|
22
|
+
update({ x, y }: EventType): void;
|
|
23
|
+
updateOrientation(): void;
|
|
24
|
+
initComposition(): void;
|
|
25
|
+
addTarget(target: CompositionTransformerTarget): void;
|
|
26
|
+
removeTarget(name: string): void;
|
|
27
|
+
private moveLayer;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type AngleType } from './utils/angle-limit';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
AlipayJSBridge: any;
|
|
5
|
+
WindVane: any;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export type DeviceOrientationOptions = {
|
|
9
|
+
X?: boolean;
|
|
10
|
+
Y?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 监听时间片段(一秒30帧)
|
|
13
|
+
*/
|
|
14
|
+
interval?: number;
|
|
15
|
+
/**
|
|
16
|
+
* 使用 requestAnimationFrame 对齐
|
|
17
|
+
*/
|
|
18
|
+
useRequestAnimationFrame?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* bate 角度使用相对初始化的
|
|
21
|
+
*/
|
|
22
|
+
relativeBeta?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* gamma 角度使用相对初始化的
|
|
25
|
+
*/
|
|
26
|
+
relativeGamma?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 限制 3d 角度范围
|
|
29
|
+
*/
|
|
30
|
+
validRange: {
|
|
31
|
+
/**
|
|
32
|
+
* 相对范围
|
|
33
|
+
*/
|
|
34
|
+
alpha: number[];
|
|
35
|
+
/**
|
|
36
|
+
* 上下翻转
|
|
37
|
+
*/
|
|
38
|
+
beta: number[];
|
|
39
|
+
/**
|
|
40
|
+
* 左右翻转
|
|
41
|
+
*/
|
|
42
|
+
gamma: number[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* 稳定区间
|
|
46
|
+
*/
|
|
47
|
+
stableRange: number;
|
|
48
|
+
};
|
|
49
|
+
export declare class DeviceOrientation {
|
|
50
|
+
private options;
|
|
51
|
+
private lastX;
|
|
52
|
+
private lastY;
|
|
53
|
+
private prevAcceler;
|
|
54
|
+
private stoped;
|
|
55
|
+
private readonly filterX;
|
|
56
|
+
private readonly filterY;
|
|
57
|
+
private watchListener?;
|
|
58
|
+
constructor(options?: {});
|
|
59
|
+
watch(callback: (x: number, y: number, data: AngleType) => void): void;
|
|
60
|
+
unWatch(): void;
|
|
61
|
+
pause(): void;
|
|
62
|
+
continue(): void;
|
|
63
|
+
private isValid;
|
|
64
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
ge: any;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export { getAdapter, closeDeviceMotion, openDeviceMotion } from './orientation-plugin-loader';
|
|
7
|
+
export { OrientationAdapterAcceler } from './orientation-adapter-acceler';
|
|
8
|
+
export declare const version: string;
|