Skip to content

Commit

Permalink
feat: update code
Browse files Browse the repository at this point in the history
  • Loading branch information
cptbtptpbcptdtptp committed Jan 9, 2025
2 parents 406b95a + 63a5662 commit cada2c0
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 124 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/particle/modules/ParticleGradient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class GradientColorKey {

set time(value: number) {
this._time = value;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
}

/**
Expand Down Expand Up @@ -293,7 +293,7 @@ export class GradientAlphaKey {

set time(value: number) {
this._time = value;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
}

/**
Expand All @@ -305,7 +305,7 @@ export class GradientAlphaKey {

set alpha(value: number) {
this._alpha = value;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
}

/**
Expand Down
30 changes: 15 additions & 15 deletions packages/math/src/Color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
out._g = left._g + right._g;
out._b = left._b + right._b;
out._a = left._a + right._a;
out._onValueChanged && out._onValueChanged();
out._onValueChanged?.();

return out;
}
Expand All @@ -79,7 +79,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
out._g = left._g - right._g;
out._b = left._b - right._b;
out._a = left._a - right._a;
out._onValueChanged && out._onValueChanged();
out._onValueChanged?.();
}

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

return out;
}
Expand All @@ -112,7 +112,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
out._g = _g + (end._g - _g) * t;
out._b = _b + (end._b - _b) * t;
out._a = _a + (end._a - _a) * t;
out._onValueChanged && out._onValueChanged();
out._onValueChanged?.();

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

public set r(value: number) {
this._r = value;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
}

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

public set g(value: number) {
this._g = value;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
}

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

public set b(value: number) {
this._b = value;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
}

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

public set a(value: number) {
this._a = value;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
}

/**
Expand Down Expand Up @@ -203,7 +203,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
this._g = g;
this._b = b;
this._a = a;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
return this;
}

Expand All @@ -217,7 +217,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
this._g += color._g;
this._b += color._b;
this._a += color._a;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
return this;
}

Expand All @@ -231,7 +231,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
this._g *= s;
this._b *= s;
this._a *= s;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
return this;
}

Expand All @@ -254,7 +254,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
this._g = source.g;
this._b = source.b;
this._a = source.a;
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
return this;
}

Expand Down Expand Up @@ -282,7 +282,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
this._g = source[offset + 1];
this._b = source[offset + 2];
this._a = source[offset + 3];
this._onValueChanged && this._onValueChanged();
this._onValueChanged?.();
return this;
}

Expand All @@ -307,7 +307,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
out._r = Color.gammaToLinearSpace(this._r);
out._g = Color.gammaToLinearSpace(this._g);
out._b = Color.gammaToLinearSpace(this._b);
out._onValueChanged && out._onValueChanged();
out._onValueChanged?.();
return out;
}

Expand All @@ -320,7 +320,7 @@ export class Color implements IClone<Color>, ICopy<ColorLike, Color> {
out._r = Color.linearToGammaSpace(this._r);
out._g = Color.linearToGammaSpace(this._g);
out._b = Color.linearToGammaSpace(this._b);
out._onValueChanged && out._onValueChanged();
out._onValueChanged?.();
return out;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ export class Matrix implements IClone<Matrix>, ICopy<Matrix, Matrix> {
out._z = 0.25 * s;
}

out._onValueChanged && out._onValueChanged();
out._onValueChanged?.();
return out;
}

Expand Down
Loading

0 comments on commit cada2c0

Please sign in to comment.