@combeenation/3d-viewer 4.0.0 → 4.0.1-alpha1
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.
|
@@ -27,6 +27,11 @@ export declare class PlacementAnimation implements AnimationInterface {
|
|
|
27
27
|
* Kills all `Tweens` of this {@link PlacementAnimation}.
|
|
28
28
|
*/
|
|
29
29
|
kill(): AnimationInterface;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a {@link AnimationDefinition} definition if not provided in the constructor and sets some defaults.
|
|
32
|
+
* Only custom properties from {@link AnimationDefinition} are adjusted, all {@link GSAPTweenVars} remain untouched.
|
|
33
|
+
*/
|
|
34
|
+
protected prepareAnimationDefinition(): void;
|
|
30
35
|
/**
|
|
31
36
|
* Prepares different types of {@link PlacementDefinition} and sets some defaults.
|
|
32
37
|
*/
|
|
@@ -47,8 +47,9 @@ var PlacementAnimation = /** @class */ (function () {
|
|
|
47
47
|
else {
|
|
48
48
|
this._animationDefinition = lodash_es_1.cloneDeep(_animation);
|
|
49
49
|
}
|
|
50
|
+
this.prepareAnimationDefinition();
|
|
50
51
|
this._timeline = gsap_1.gsap.timeline({
|
|
51
|
-
defaults:
|
|
52
|
+
defaults: this._animationDefinition,
|
|
52
53
|
paused: true
|
|
53
54
|
});
|
|
54
55
|
this.preparePlacementDefinition();
|
|
@@ -83,6 +84,21 @@ var PlacementAnimation = /** @class */ (function () {
|
|
|
83
84
|
this._timeline.kill();
|
|
84
85
|
return this;
|
|
85
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* Creates a {@link AnimationDefinition} definition if not provided in the constructor and sets some defaults.
|
|
89
|
+
* Only custom properties from {@link AnimationDefinition} are adjusted, all {@link GSAPTweenVars} remain untouched.
|
|
90
|
+
*/
|
|
91
|
+
PlacementAnimation.prototype.prepareAnimationDefinition = function () {
|
|
92
|
+
// create an animation definition if not available yet
|
|
93
|
+
this._animationDefinition = this._animationDefinition || {};
|
|
94
|
+
// parse shortest way flag or set to `true` if not configured
|
|
95
|
+
if (this._animationDefinition.shortestWay !== undefined) {
|
|
96
|
+
this._animationDefinition.shortestWay = parameter_1.Parameter.parseBoolean(this._animationDefinition.shortestWay);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this._animationDefinition.shortestWay = true;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
86
102
|
/**
|
|
87
103
|
* Prepares different types of {@link PlacementDefinition} and sets some defaults.
|
|
88
104
|
*/
|
|
@@ -92,11 +108,6 @@ var PlacementAnimation = /** @class */ (function () {
|
|
|
92
108
|
position = parameter_1.Parameter.parseVector(position);
|
|
93
109
|
this._placementDefinition.position = position;
|
|
94
110
|
}
|
|
95
|
-
var shortestWay = true;
|
|
96
|
-
if (this._animationDefinition.shortestWay !== undefined) {
|
|
97
|
-
shortestWay = parameter_1.Parameter.parseBoolean(this._animationDefinition.shortestWay);
|
|
98
|
-
this._animationDefinition.shortestWay = shortestWay;
|
|
99
|
-
}
|
|
100
111
|
if (this.mutable instanceof arcRotateCamera_1.ArcRotateCamera) {
|
|
101
112
|
// parse the target
|
|
102
113
|
if (lodash_es_1.isString(this._placementDefinition.target)) {
|
|
@@ -115,7 +126,7 @@ var PlacementAnimation = /** @class */ (function () {
|
|
|
115
126
|
delete this._placementDefinition.position;
|
|
116
127
|
ghostCam.dispose();
|
|
117
128
|
}
|
|
118
|
-
else if (shortestWay && this._placementDefinition.alpha) {
|
|
129
|
+
else if (this._animationDefinition.shortestWay && this._placementDefinition.alpha !== undefined) {
|
|
119
130
|
// transform the target's alpha value into the same turn as the current camera position to avoid movements > 360 degrees
|
|
120
131
|
var alphaGap = this.mutable.alpha - this._placementDefinition.alpha;
|
|
121
132
|
var cntTurns = Math.round(alphaGap / (2 * Math.PI));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placementAnimation.js","sourceRoot":"","sources":["../../../../src/api/classes/placementAnimation.ts"],"names":[],"mappings":";;;;AAAA,2EAA0E;AAC1E,iE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C,CAAC;aAC5D;SACD;IACF,CAAC;IAED;;OAEG;IACO,yCAAY,GAAtB;QACC,KAAK,IAAM,QAAQ,IAAI,IAAI,CAAC,oBAAoB,EAAG;YAClD,IAAM,aAAa,GAAG,eAAG,CAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAE,CAAC;YACjE,IAAM,SAAS,GAAW,EAAE,CAAC;YAC7B,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,aAAa,YAAY,qBAAO,EAAG;gBACtC,sEAAsE;gBACtE,qEAAqE;gBACrE,8BAA8B;gBAC9B,QAAQ,GAAG,eAAG,CAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAE,CAAC;gBACzC,iBAAK,CAAE,SAAS,EAAE,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAE,CAAC;aACnF;iBAAM;gBACN,eAAG,CAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAE,CAAC;aAC1C;YACD,IAAI,CAAC,SAAS,CAAC,EAAE,CAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAE,CAAC,CAAE,kDAAkD;SAChG;IACF,CAAC;IAEF,yBAAC;AAAD,CAAC,AA/ID,IA+IC;AA/IY,gDAAkB"}
|
package/package.json
CHANGED
|
@@ -47,10 +47,13 @@ export class PlacementAnimation implements AnimationInterface {
|
|
|
47
47
|
} else {
|
|
48
48
|
this._animationDefinition = cloneDeep( _animation ) as AnimationDefinition;
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
this.prepareAnimationDefinition();
|
|
50
52
|
this._timeline = gsap.timeline( {
|
|
51
|
-
defaults:
|
|
53
|
+
defaults: this._animationDefinition,
|
|
52
54
|
paused: true
|
|
53
55
|
} );
|
|
56
|
+
|
|
54
57
|
this.preparePlacementDefinition();
|
|
55
58
|
this.createTweens();
|
|
56
59
|
}
|
|
@@ -79,6 +82,22 @@ export class PlacementAnimation implements AnimationInterface {
|
|
|
79
82
|
return this;
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Creates a {@link AnimationDefinition} definition if not provided in the constructor and sets some defaults.
|
|
87
|
+
* Only custom properties from {@link AnimationDefinition} are adjusted, all {@link GSAPTweenVars} remain untouched.
|
|
88
|
+
*/
|
|
89
|
+
protected prepareAnimationDefinition() {
|
|
90
|
+
// create an animation definition if not available yet
|
|
91
|
+
this._animationDefinition = this._animationDefinition || {};
|
|
92
|
+
|
|
93
|
+
// parse shortest way flag or set to `true` if not configured
|
|
94
|
+
if( this._animationDefinition.shortestWay !== undefined ) {
|
|
95
|
+
this._animationDefinition.shortestWay = Parameter.parseBoolean( this._animationDefinition.shortestWay );
|
|
96
|
+
} else {
|
|
97
|
+
this._animationDefinition.shortestWay = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
82
101
|
/**
|
|
83
102
|
* Prepares different types of {@link PlacementDefinition} and sets some defaults.
|
|
84
103
|
*/
|
|
@@ -88,11 +107,6 @@ export class PlacementAnimation implements AnimationInterface {
|
|
|
88
107
|
position = Parameter.parseVector( position );
|
|
89
108
|
this._placementDefinition.position = position;
|
|
90
109
|
}
|
|
91
|
-
let shortestWay = true;
|
|
92
|
-
if( this._animationDefinition.shortestWay !== undefined ) {
|
|
93
|
-
shortestWay = Parameter.parseBoolean( this._animationDefinition.shortestWay );
|
|
94
|
-
this._animationDefinition.shortestWay = shortestWay;
|
|
95
|
-
}
|
|
96
110
|
if( this.mutable instanceof ArcRotateCamera ) {
|
|
97
111
|
// parse the target
|
|
98
112
|
if( isString( this._placementDefinition.target ) ) {
|
|
@@ -110,7 +124,7 @@ export class PlacementAnimation implements AnimationInterface {
|
|
|
110
124
|
} );
|
|
111
125
|
delete this._placementDefinition.position;
|
|
112
126
|
ghostCam.dispose();
|
|
113
|
-
} else if( shortestWay && this._placementDefinition.alpha ) {
|
|
127
|
+
} else if( this._animationDefinition.shortestWay && this._placementDefinition.alpha !== undefined ) {
|
|
114
128
|
// transform the target's alpha value into the same turn as the current camera position to avoid movements > 360 degrees
|
|
115
129
|
const alphaGap = this.mutable.alpha - this._placementDefinition.alpha;
|
|
116
130
|
const cntTurns = Math.round(alphaGap / (2 * Math.PI));
|