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 15, 2024
1 parent c377096 commit a19c0d3
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 @@ -31,6 +31,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 Down Expand Up @@ -67,6 +73,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],
swingOffset: 15,
Expand Down Expand Up @@ -121,8 +128,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 a19c0d3

Please sign in to comment.