Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added tilt effect to particles, this was called wobble in previ…
…ous commit build: disabled wobble effect since it was the tilt effect, this needs new work
- Loading branch information
1 parent
a3e9769
commit 7eade2e
Showing
13 changed files
with
213 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @category Enums | ||
*/ | ||
export enum TiltDirection { | ||
clockwise = "clockwise", | ||
counterClockwise = "counter-clockwise", | ||
random = "random", | ||
} | ||
|
||
export type TiltDirectionAlt = "counter-clockwise"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from "./MoveDirection"; | ||
export * from "./RotateDirection"; | ||
export * from "./OutModeDirection"; | ||
export * from "./TiltDirection"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { TiltAnimation } from "./TiltAnimation"; | ||
import { TiltDirection, TiltDirectionAlt } from "../../../../Enums"; | ||
import type { RecursivePartial } from "../../../../Types"; | ||
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader"; | ||
import { ValueWithRandom } from "../../ValueWithRandom"; | ||
import type { ITilt } from "../../../Interfaces/Particles/Tilt/ITilt"; | ||
|
||
/** | ||
* [[include:Options/Particles/Rotate.md]] | ||
* @category Options | ||
*/ | ||
export class Tilt extends ValueWithRandom implements ITilt, IOptionLoader<ITilt> { | ||
animation; | ||
direction: TiltDirection | keyof typeof TiltDirection | TiltDirectionAlt; | ||
enable; | ||
|
||
constructor() { | ||
super(); | ||
this.animation = new TiltAnimation(); | ||
this.direction = TiltDirection.clockwise; | ||
this.enable = false; | ||
this.value = 0; | ||
} | ||
|
||
load(data?: RecursivePartial<ITilt>): void { | ||
if (!data) { | ||
return; | ||
} | ||
|
||
super.load(data); | ||
|
||
this.animation.load(data.animation); | ||
|
||
if (data.direction !== undefined) { | ||
this.direction = data.direction; | ||
} | ||
|
||
if (data.enable !== undefined) { | ||
this.enable = data.enable; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
core/main/src/Options/Classes/Particles/Tilt/TiltAnimation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { RecursivePartial } from "../../../../Types"; | ||
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader"; | ||
import type { ITiltAnimation } from "../../../Interfaces/Particles/Tilt/ITiltAnimation"; | ||
|
||
/** | ||
* @category Options | ||
*/ | ||
export class TiltAnimation implements ITiltAnimation, IOptionLoader<ITiltAnimation> { | ||
enable; | ||
speed; | ||
sync; | ||
|
||
constructor() { | ||
this.enable = false; | ||
this.speed = 0; | ||
this.sync = false; | ||
} | ||
|
||
load(data?: RecursivePartial<ITiltAnimation>): void { | ||
if (data === undefined) { | ||
return; | ||
} | ||
|
||
if (data.enable !== undefined) { | ||
this.enable = data.enable; | ||
} | ||
|
||
if (data.speed !== undefined) { | ||
this.speed = data.speed; | ||
} | ||
|
||
if (data.sync !== undefined) { | ||
this.sync = data.sync; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { ITiltAnimation } from "./ITiltAnimation"; | ||
import type { TiltDirection, TiltDirectionAlt } from "../../../../Enums"; | ||
import type { IValueWithRandom } from "../../IValueWithRandom"; | ||
|
||
/** | ||
* [[include:Options/Particles/Rotate.md]] | ||
* @category Options | ||
*/ | ||
export interface ITilt extends IValueWithRandom { | ||
animation: ITiltAnimation; | ||
direction: TiltDirection | keyof typeof TiltDirection | TiltDirectionAlt; | ||
enable: boolean; | ||
} |
8 changes: 8 additions & 0 deletions
8
core/main/src/Options/Interfaces/Particles/Tilt/ITiltAnimation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @category Options | ||
*/ | ||
export interface ITiltAnimation { | ||
enable: boolean; | ||
speed: number; | ||
sync: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters