@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 ADDED
@@ -0,0 +1,13 @@
1
+ # 陀螺仪插件
2
+
3
+ ## 本地开发
4
+
5
+ ### 开始开发
6
+
7
+ ``` bash
8
+ # demo
9
+ pnpm --filter @galacean/effects-plugin-orientation-transformer dev
10
+ ```
11
+
12
+ > 浏览器打开:http://localhost:8081/demo/
13
+
@@ -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
+ }
@@ -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;