@soonspacejs/plugin-model-blast 2.13.10 → 2.13.12
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/dist/index.d.ts +21 -21
- package/dist/index.esm.js +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import SoonSpace from 'soonspacejs';
|
|
2
|
-
import { Object3D, Vector3 } from 'three';
|
|
3
|
-
export default class ModelBlastPlugin {
|
|
4
|
-
readonly ssp: SoonSpace;
|
|
5
|
-
prevObjects: Set<Object3D>;
|
|
6
|
-
childDirs: Map<string, Vector3>;
|
|
7
|
-
childPositions: Map<string, Vector3>;
|
|
8
|
-
constructor(ssp: SoonSpace);
|
|
9
|
-
start(object: Object3D, scalar?: number): void;
|
|
10
|
-
stop(object?: Object3D): void;
|
|
11
|
-
objectActionMap: Map<Object3D<import("three").Object3DEventMap>[], {
|
|
12
|
-
setTime: (time?: number) => void;
|
|
13
|
-
stop: () => void;
|
|
14
|
-
}>;
|
|
15
|
-
startForObjects(objects: Object3D[], scalar?: number): void;
|
|
16
|
-
stopForObjects(objects?: Object3D[]): void;
|
|
17
|
-
}
|
|
18
|
-
export declare function blastObjects(objects: Object3D[], ssp: SoonSpace): {
|
|
19
|
-
setTime: (time?: number) => void;
|
|
20
|
-
stop: () => void;
|
|
21
|
-
};
|
|
1
|
+
import SoonSpace from 'soonspacejs';
|
|
2
|
+
import { Object3D, Vector3 } from 'three';
|
|
3
|
+
export default class ModelBlastPlugin {
|
|
4
|
+
readonly ssp: SoonSpace;
|
|
5
|
+
prevObjects: Set<Object3D>;
|
|
6
|
+
childDirs: Map<string, Vector3>;
|
|
7
|
+
childPositions: Map<string, Vector3>;
|
|
8
|
+
constructor(ssp: SoonSpace);
|
|
9
|
+
start(object: Object3D, scalar?: number): void;
|
|
10
|
+
stop(object?: Object3D): void;
|
|
11
|
+
objectActionMap: Map<Object3D<import("three").Object3DEventMap>[], {
|
|
12
|
+
setTime: (time?: number) => void;
|
|
13
|
+
stop: () => void;
|
|
14
|
+
}>;
|
|
15
|
+
startForObjects(objects: Object3D[], scalar?: number): void;
|
|
16
|
+
stopForObjects(objects?: Object3D[]): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function blastObjects(objects: Object3D[], ssp: SoonSpace): {
|
|
19
|
+
setTime: (time?: number) => void;
|
|
20
|
+
stop: () => void;
|
|
21
|
+
};
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Vector3 as t,Quaternion as i,Box3 as s}from"three";class e{constructor(t){this.ssp=t,this.prevObjects=new Set,this.childDirs=new Map,this.childPositions=new Map,this.objectActionMap=new Map}start(s,e){this.prevObjects.add(s);const{ssp:o}=this,n=o.utils.getBoundingBox(s),c=n.getSize(new t),r=n.getCenter(new t),u=null!=e?e:Math.max(c.x,c.y,c.z);s.traverse(
|
|
1
|
+
import{Vector3 as t,Quaternion as i,Box3 as s}from"three";class e{constructor(t){this.ssp=t,this.prevObjects=new Set,this.childDirs=new Map,this.childPositions=new Map,this.objectActionMap=new Map}start(s,e){this.prevObjects.add(s);const{ssp:o}=this,n=o.utils.getBoundingBox(s),c=n.getSize(new t),r=n.getCenter(new t),u=null!=e?e:Math.max(c.x,c.y,c.z);s.traverse(s=>{if("Mesh"===s.type){if(!this.childDirs.has(s.uuid)||!this.childPositions.has(s.uuid)){const e=o.utils.getBoundingBox(s).getCenter(new t),n=(new t).subVectors(e,r).normalize();if(s.parent){const t=s.parent.getWorldQuaternion(new i);t.invert(),n.applyQuaternion(t)}this.childDirs.set(s.uuid,n),this.childPositions.set(s.uuid,s.position.clone())}s.position.copy((new t).copy(this.childPositions.get(s.uuid)).add((new t).copy(this.childDirs.get(s.uuid)).multiplyScalar(u))),this.ssp.render()}})}stop(t){let i=t;if(!i){const t=[...this.prevObjects].at(-1);t&&(this.prevObjects.delete(t),i=t)}null==i||i.traverse(t=>{"Mesh"===t.type&&this.childDirs.has(t.uuid)&&this.childPositions.has(t.uuid)&&(t.position.copy(this.childPositions.get(t.uuid)),this.childDirs.delete(t.uuid),this.childPositions.delete(t.uuid))}),this.ssp.render()}startForObjects(t,i){var s;const{ssp:e,objectActionMap:n}=this;if(!n.has(t)){const i=o(t,e);n.set(t,i)}null===(s=n.get(t))||void 0===s||s.setTime(i)}stopForObjects(t){var i;const{objectActionMap:s}=this;t||(t=[...s.keys()].at(-1)),t&&(null===(i=s.get(t))||void 0===i||i.stop(),s.delete(t))}}function o(e,o){const n=o.utils.getBoundingBox,c={},r={};let u={};const d=new s;for(const t of e){const i=n(t);u[t.uuid]=i,d.union(i)}const l=d.getCenter(new t),h=d.getSize(new t),a=Math.max(h.x,h.y,h.z),p=new t;for(const s of e){const{uuid:e,position:o,parent:n}=s;r[e]=o.clone(),u[e].getCenter(p);const d=new t;if(d.subVectors(p,l),n){const t=n.getWorldQuaternion(new i);t.invert(),d.applyQuaternion(t)}d.normalize(),c[e]=d}return u=null,{setTime:function(t=a){for(const i of e){const{uuid:s,position:e}=i,o=c[s],n=r[s];e.copy(o).multiplyScalar(t).add(n)}o.render()},stop:function(){for(const t of e){const{uuid:i,position:s}=t,e=r[i];s.copy(e)}o.render()}}}export{o as blastObjects,e as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-model-blast",
|
|
3
3
|
"pluginName": "ModelBlastPlugin",
|
|
4
|
-
"version": "2.13.
|
|
4
|
+
"version": "2.13.12",
|
|
5
5
|
"description": "Model blast plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xunwei",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "aa34f472ae1520b537b0a5a1d67f4a746f41236a",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.13.
|
|
18
|
+
"soonspacejs": "2.13.12"
|
|
19
19
|
}
|
|
20
20
|
}
|