@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CompositionTransformerAcceler } from './composition-transformer-acceler';
|
|
2
|
+
export type AccelerMotionData = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare class OrientationAdapterAcceler {
|
|
10
|
+
private transformers;
|
|
11
|
+
private connected;
|
|
12
|
+
private accelerMotion;
|
|
13
|
+
private validRange;
|
|
14
|
+
connect(): void;
|
|
15
|
+
disconnect(): void;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param motion
|
|
19
|
+
*/
|
|
20
|
+
dispatchMotion(motion: AccelerMotionData): void;
|
|
21
|
+
addTransformer(transformer: CompositionTransformerAcceler): void;
|
|
22
|
+
removeTransformer(transformer: CompositionTransformerAcceler): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function getAccelerAdapter(): OrientationAdapterAcceler;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Composition, Disposable } from '@galacean/effects';
|
|
2
|
+
import { AbstractPlugin } from '@galacean/effects';
|
|
3
|
+
import type { OrientationAdapterAcceler } from './orientation-adapter-acceler';
|
|
4
|
+
export declare class OrientationPluginLoader extends AbstractPlugin implements Disposable {
|
|
5
|
+
order: number;
|
|
6
|
+
private adapter;
|
|
7
|
+
onCompositionConstructed(): void;
|
|
8
|
+
onCompositionReset(composition: Composition): void;
|
|
9
|
+
onCompositionUpdate(composition: Composition): void;
|
|
10
|
+
onCompositionDestroyed(composition: Composition): void;
|
|
11
|
+
private handleConnect;
|
|
12
|
+
private handleDisconnect;
|
|
13
|
+
private bindAccelerDocumentEvent;
|
|
14
|
+
private unbindAccelerDocumentEvent;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAdapter(): OrientationAdapterAcceler;
|
|
22
|
+
export declare function closeDeviceMotion(): void;
|
|
23
|
+
export declare function openDeviceMotion(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { spec, Composition } from '@galacean/effects';
|
|
2
|
+
import { VFXItem } from '@galacean/effects';
|
|
3
|
+
import type { TransformItem } from './transform-item';
|
|
4
|
+
export declare class TransformVFXItem extends VFXItem<TransformItem> {
|
|
5
|
+
private targets?;
|
|
6
|
+
get type(): spec.ItemType;
|
|
7
|
+
onConstructed(options: any): void;
|
|
8
|
+
onItemRemoved(composition: Composition): void;
|
|
9
|
+
protected doCreateContent(composition: Composition): {};
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type AngleType = {
|
|
2
|
+
alpha: number;
|
|
3
|
+
beta: number;
|
|
4
|
+
gamma: number;
|
|
5
|
+
};
|
|
6
|
+
type RangeType = {
|
|
7
|
+
alpha: number[];
|
|
8
|
+
beta: number[];
|
|
9
|
+
gamma: number[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 角度限制
|
|
13
|
+
* @internal
|
|
14
|
+
* @param angleObj 角度数值对象
|
|
15
|
+
* @param validRange 角度限制值
|
|
16
|
+
*/
|
|
17
|
+
export declare function angleLimit(angleObj: AngleType, validRange: RangeType): boolean;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deepMerge(target: any, args?: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isIOS(): number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
type FilteringOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* 稳定区间
|
|
7
|
+
*/
|
|
8
|
+
stableRange?: number;
|
|
9
|
+
/**
|
|
10
|
+
* 最大变幅
|
|
11
|
+
*/
|
|
12
|
+
maxChange?: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 滤波方法
|
|
16
|
+
*/
|
|
17
|
+
export declare class Filtering {
|
|
18
|
+
private readonly options;
|
|
19
|
+
private lastValue;
|
|
20
|
+
private valuePool;
|
|
21
|
+
constructor(options?: FilteringOptions);
|
|
22
|
+
/**
|
|
23
|
+
* 0deg 左右保持一定的稳定区间 STABLE_RANGE
|
|
24
|
+
* - 小于 STABLE_RANGE 的算 0
|
|
25
|
+
* - 大于 STABLE_RANGE 的减去 STABLE_RANGE
|
|
26
|
+
* @param value - 输入值
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
stableFix(value: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* 变幅限制
|
|
32
|
+
* - 最大变化 MAX_CHANGE
|
|
33
|
+
* - 最小变化 MIN_CHANGE
|
|
34
|
+
* @param value
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
changeLimit(value: number): number;
|
|
38
|
+
linearRegressionMedian(value: number): number;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getObjectType(obj: any): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@galacean/effects-plugin-orientation-transformer",
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"description": "Galacean Effects player orientation transformer plugin",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"brower": "./dist/index.min.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"contributors": [
|
|
20
|
+
{
|
|
21
|
+
"name": "燃然"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "意绮"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"author": "Ant Group CO., Ltd.",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"registry": "https://registry.npmjs.org"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@galacean/effects": "0.0.1-alpha.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"dev": "vite",
|
|
38
|
+
"preview": "concurrently -k \"vite build -w\" \"sleep 6 && vite preview\"",
|
|
39
|
+
"prebuild": "pnpm clean",
|
|
40
|
+
"build": "pnpm build:declaration && pnpm build:module",
|
|
41
|
+
"build:module": "rollup -c",
|
|
42
|
+
"build:declaration": "tsc -d --declarationDir dist --emitDeclarationOnly",
|
|
43
|
+
"build:demo": "rimraf dist && vite build",
|
|
44
|
+
"clean": "rimraf dist && rimraf '*+(.tsbuildinfo)'"
|
|
45
|
+
}
|
|
46
|
+
}
|