Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support for multiline text in canvas mask text options
- Loading branch information
1 parent
2ec03cc
commit eceacbe
Showing
8 changed files
with
172 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
"smooth": true, | ||
"interactivity": { | ||
"events": { | ||
"onHover": { | ||
"enable": true, | ||
"mode": "bubble", | ||
"parallax": { | ||
"enable": false, | ||
"force": 2, | ||
"smooth": 10 | ||
} | ||
} | ||
}, | ||
"modes": { | ||
"bubble": { | ||
"distance": 40, | ||
"duration": 2, | ||
"opacity": 8, | ||
"size": 15 | ||
} | ||
} | ||
}, | ||
"particles": { | ||
"move": { | ||
"direction": "none", | ||
"distance": 2, | ||
"enable": true, | ||
"outModes": "out", | ||
"speed": 1 | ||
}, | ||
"number": { | ||
"value": 600 | ||
}, | ||
"color": { | ||
"value": "random" | ||
}, | ||
"shape": { | ||
"type": [ | ||
"circle", | ||
"square", | ||
"triangle" | ||
] | ||
}, | ||
"size": { | ||
"value": { | ||
"min": 1, | ||
"max": 3 | ||
} | ||
} | ||
}, | ||
"canvasMask": { | ||
"enable": true, | ||
"override": { | ||
"color": false | ||
}, | ||
"scale": 1, | ||
"pixels": { | ||
"filter": "pixelTextFilter" | ||
}, | ||
"position": { | ||
"x": 70, | ||
"y": 30 | ||
}, | ||
"text": { | ||
"color": "#ff0000", | ||
"font": { | ||
"size": 500 | ||
}, | ||
"text": "Hello\nWorld", | ||
"lines": { | ||
"spacing": 50 | ||
} | ||
} | ||
}, | ||
"background": { | ||
"color": "#000000", | ||
"image": "", | ||
"position": "50% 50%", | ||
"repeat": "no-repeat", | ||
"size": "cover" | ||
} | ||
} |
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,26 @@ | ||
import type { IOptionLoader, RecursivePartial } from "tsparticles-engine"; | ||
import type { ITextMaskLine } from "../Interfaces/ITextMaskLine"; | ||
|
||
export class TextMaskLine implements ITextMaskLine, IOptionLoader<ITextMaskLine> { | ||
separator: string; | ||
spacing: number; | ||
|
||
constructor() { | ||
this.separator = "\n"; | ||
this.spacing = 10; | ||
} | ||
|
||
load(data?: RecursivePartial<ITextMaskLine> | undefined): void { | ||
if (!data) { | ||
return; | ||
} | ||
|
||
if (data.separator !== undefined) { | ||
this.separator = data.separator; | ||
} | ||
|
||
if (data.spacing !== undefined) { | ||
this.spacing = data.spacing; | ||
} | ||
} | ||
} |
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,7 +1,9 @@ | ||
import type { IFontTextMask } from "./IFontTextMask"; | ||
import type { ITextMaskLine } from "./ITextMaskLine"; | ||
|
||
export interface ITextMask { | ||
color: string; | ||
font: IFontTextMask; | ||
lines: ITextMaskLine; | ||
text: string; | ||
} |
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,4 @@ | ||
export interface ITextMaskLine { | ||
separator: string; | ||
spacing: number; | ||
} |
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