three-base 1.0.79 → 1.0.80

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.
@@ -42,7 +42,7 @@ export default class ThreeBase extends EventDispatcher {
42
42
  needRender: boolean;
43
43
  stopRender(): void;
44
44
  render(): void;
45
- renderBindThis: any;
45
+ private renderBindThis;
46
46
  download(fileName?: string): void;
47
47
  private _preMesh;
48
48
  private _preRT;
package/lib/ThreeBase.ts CHANGED
@@ -309,7 +309,7 @@ export default class ThreeBase extends EventDispatcher {
309
309
  this.dispatchEvent({ type: "afterRender" });
310
310
  }
311
311
 
312
- renderBindThis = this.render.bind(this);
312
+ private renderBindThis = this.render.bind(this);
313
313
 
314
314
  // 下载渲染图
315
315
  download(fileName: string = "download") {
@@ -23,9 +23,7 @@ export default class Transition {
23
23
  _: {
24
24
  [key: string]: number;
25
25
  };
26
- onChangeCall?: (josn: {
27
- [key: string]: number;
28
- }) => void;
26
+ private onChangeCall;
29
27
  run({ timeTemp }: any): this;
30
28
  runbindThis: any;
31
29
  onChange(onChangeCall: (josn: {
package/lib/Transition.js CHANGED
@@ -23,7 +23,7 @@ export default class Transition {
23
23
  constructor(param = {}, bezier = [0.8, 0, 0.2, 1], duration = 500) {
24
24
  this.setDuration(duration);
25
25
  this.setBezier(bezier);
26
- this.set(param);
26
+ this.reset(param);
27
27
  }
28
28
  // 所有的 key 的枚举
29
29
  _keys = [];
@@ -57,7 +57,7 @@ export default class Transition {
57
57
  }
58
58
  // 存储 每个参数的 起始位置 起始时间 终止位置 终止时间
59
59
  _ = {};
60
- onChangeCall;
60
+ onChangeCall = (josn) => { };
61
61
  // 执行过度动画
62
62
  run({ timeTemp }) {
63
63
  this.timeTemp = timeTemp;
@@ -133,9 +133,9 @@ export default class Transition {
133
133
  // // 执行状态未完成
134
134
  // this._isDone = false;
135
135
  }
136
- threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
137
- threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
138
136
  if (!this._isDone) {
137
+ threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
138
+ threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
139
139
  await new Promise(resolve => setTimeout(resolve, this._duration + 50));
140
140
  }
141
141
  return this;
@@ -143,6 +143,9 @@ export default class Transition {
143
143
  // 重置起始和终止位置
144
144
  reset(param) {
145
145
  for (let key in param) {
146
+ if (!this._keys.includes(key)) {
147
+ this._keys.push(key);
148
+ }
146
149
  this._[key + "_start"] = param[key];
147
150
  this._[key + "_end"] = param[key];
148
151
  this._[key + "_startTime"] = -this._duration;
package/lib/Transition.ts CHANGED
@@ -36,7 +36,7 @@ export default class Transition {
36
36
 
37
37
  this.setBezier(bezier);
38
38
 
39
- this.set(param);
39
+ this.reset(param);
40
40
  }
41
41
 
42
42
  // 所有的 key 的枚举
@@ -82,7 +82,7 @@ export default class Transition {
82
82
  // 存储 每个参数的 起始位置 起始时间 终止位置 终止时间
83
83
  _: { [key: string]: number } = {};
84
84
 
85
- onChangeCall?: (josn: { [key: string]: number }) => void;
85
+ private onChangeCall = (josn: { [key: string]: number }) => { };
86
86
 
87
87
  // 执行过度动画
88
88
  run({ timeTemp }: any) {
@@ -185,10 +185,9 @@ export default class Transition {
185
185
 
186
186
  }
187
187
 
188
- threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
189
- threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
190
-
191
188
  if (!this._isDone) {
189
+ threeUtils.removeEventListener("requestAnimationFrame", this.runbindThis);
190
+ threeUtils.addEventListener("requestAnimationFrame", this.runbindThis);
192
191
  await new Promise(resolve => setTimeout(resolve, this._duration + 50));
193
192
  }
194
193
 
@@ -198,6 +197,11 @@ export default class Transition {
198
197
  reset(param: TParam): this {
199
198
 
200
199
  for (let key in param) {
200
+
201
+ if (!this._keys.includes(key)) {
202
+ this._keys.push(key);
203
+ }
204
+
201
205
  this._[key + "_start"] = param[key];
202
206
  this._[key + "_end"] = param[key];
203
207
  this._[key + "_startTime"] = -this._duration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "description": "three 3d three-base",
5
5
  "repository": {
6
6
  "type": "git",