Skip to content

Commit

Permalink
Add size option to default balloon close #249
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonStnn committed Jul 5, 2024
1 parent d10fa71 commit 8342adf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/balloons/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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],
};
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 8342adf

Please sign in to comment.