Skip to content

Commit cada2c0

Browse files
feat: update code
2 parents 406b95a + 63a5662 commit cada2c0

File tree

8 files changed

+124
-124
lines changed

8 files changed

+124
-124
lines changed

packages/core/src/particle/modules/ParticleGradient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export class GradientColorKey {
245245

246246
set time(value: number) {
247247
this._time = value;
248-
this._onValueChanged && this._onValueChanged();
248+
this._onValueChanged?.();
249249
}
250250

251251
/**
@@ -293,7 +293,7 @@ export class GradientAlphaKey {
293293

294294
set time(value: number) {
295295
this._time = value;
296-
this._onValueChanged && this._onValueChanged();
296+
this._onValueChanged?.();
297297
}
298298

299299
/**
@@ -305,7 +305,7 @@ export class GradientAlphaKey {
305305

306306
set alpha(value: number) {
307307
this._alpha = value;
308-
this._onValueChanged && this._onValueChanged();
308+
this._onValueChanged?.();
309309
}
310310

311311
/**

packages/math/src/Color.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
6363
out._g = left._g + right._g;
6464
out._b = left._b + right._b;
6565
out._a = left._a + right._a;
66-
out._onValueChanged && out._onValueChanged();
66+
out._onValueChanged?.();
6767

6868
return out;
6969
}
@@ -79,7 +79,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
7979
out._g = left._g - right._g;
8080
out._b = left._b - right._b;
8181
out._a = left._a - right._a;
82-
out._onValueChanged && out._onValueChanged();
82+
out._onValueChanged?.();
8383
}
8484

8585
/**
@@ -94,7 +94,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
9494
out._g = left._g * s;
9595
out._b = left._b * s;
9696
out._a = left._a * s;
97-
out._onValueChanged && out._onValueChanged();
97+
out._onValueChanged?.();
9898

9999
return out;
100100
}
@@ -112,7 +112,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
112112
out._g = _g + (end._g - _g) * t;
113113
out._b = _b + (end._b - _b) * t;
114114
out._a = _a + (end._a - _a) * t;
115-
out._onValueChanged && out._onValueChanged();
115+
out._onValueChanged?.();
116116

117117
return out;
118118
}
@@ -137,7 +137,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
137137

138138
public set r(value: number) {
139139
this._r = value;
140-
this._onValueChanged && this._onValueChanged();
140+
this._onValueChanged?.();
141141
}
142142

143143
/**
@@ -149,7 +149,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
149149

150150
public set g(value: number) {
151151
this._g = value;
152-
this._onValueChanged && this._onValueChanged();
152+
this._onValueChanged?.();
153153
}
154154

155155
/**
@@ -161,7 +161,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
161161

162162
public set b(value: number) {
163163
this._b = value;
164-
this._onValueChanged && this._onValueChanged();
164+
this._onValueChanged?.();
165165
}
166166

167167
/**
@@ -173,7 +173,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
173173

174174
public set a(value: number) {
175175
this._a = value;
176-
this._onValueChanged && this._onValueChanged();
176+
this._onValueChanged?.();
177177
}
178178

179179
/**
@@ -203,7 +203,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
203203
this._g = g;
204204
this._b = b;
205205
this._a = a;
206-
this._onValueChanged && this._onValueChanged();
206+
this._onValueChanged?.();
207207
return this;
208208
}
209209

@@ -217,7 +217,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
217217
this._g += color._g;
218218
this._b += color._b;
219219
this._a += color._a;
220-
this._onValueChanged && this._onValueChanged();
220+
this._onValueChanged?.();
221221
return this;
222222
}
223223

@@ -231,7 +231,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
231231
this._g *= s;
232232
this._b *= s;
233233
this._a *= s;
234-
this._onValueChanged && this._onValueChanged();
234+
this._onValueChanged?.();
235235
return this;
236236
}
237237

@@ -254,7 +254,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
254254
this._g = source.g;
255255
this._b = source.b;
256256
this._a = source.a;
257-
this._onValueChanged && this._onValueChanged();
257+
this._onValueChanged?.();
258258
return this;
259259
}
260260

@@ -282,7 +282,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
282282
this._g = source[offset + 1];
283283
this._b = source[offset + 2];
284284
this._a = source[offset + 3];
285-
this._onValueChanged && this._onValueChanged();
285+
this._onValueChanged?.();
286286
return this;
287287
}
288288

@@ -307,7 +307,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
307307
out._r = Color.gammaToLinearSpace(this._r);
308308
out._g = Color.gammaToLinearSpace(this._g);
309309
out._b = Color.gammaToLinearSpace(this._b);
310-
out._onValueChanged && out._onValueChanged();
310+
out._onValueChanged?.();
311311
return out;
312312
}
313313

@@ -320,7 +320,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
320320
out._r = Color.linearToGammaSpace(this._r);
321321
out._g = Color.linearToGammaSpace(this._g);
322322
out._b = Color.linearToGammaSpace(this._b);
323-
out._onValueChanged && out._onValueChanged();
323+
out._onValueChanged?.();
324324
return out;
325325
}
326326

packages/math/src/Matrix.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ export class Matrix implements IClone<Matrix>, ICopy<Matrix, Matrix> {
10661066
out._z = 0.25 * s;
10671067
}
10681068

1069-
out._onValueChanged && out._onValueChanged();
1069+
out._onValueChanged?.();
10701070
return out;
10711071
}
10721072

0 commit comments

Comments
 (0)