From 8342adf85eca889abdc981f3b7839e22915406ac Mon Sep 17 00:00:00 2001 From: SimonStnn Date: Fri, 5 Jul 2024 09:11:39 +0200 Subject: [PATCH] Add size option to default balloon close #249 --- src/balloons/default.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/balloons/default.ts b/src/balloons/default.ts index a176ff04..8e8f19d4 100644 --- a/src/balloons/default.ts +++ b/src/balloons/default.ts @@ -30,6 +30,12 @@ export type BalloonOptions = { * If not provided, the default sound will be used. */ popSoundUrl: string; + /** + * The size of the balloon. + * + * The first value is the minimum size and the second value is the maximum size. + */ + size: [number, number]; /** * The duration thresholds for the rise animation. * @@ -56,6 +62,7 @@ export default class Default extends Balloon { dir_name: this.name, imageUrl: this.originalPath('/icon.png'), popSoundUrl: this.originalPath('/pop.mp3'), + size: [50, 75], riseDurationThreshold: [10000, 15000], swingDurationThreshold: [2, 4], }; @@ -103,8 +110,8 @@ export default class Default extends Balloon { } public build() { - const size = random(50, 75); const positionX = random(5, 95); + const size = random(this.options.size[0], this.options.size[1]); const riseDuration = random( this.options.riseDurationThreshold[0], this.options.riseDurationThreshold[1]