Comparing version 1.2.4 to 1.2.5
@@ -8,3 +8,3 @@ const Random = require('./random.js'); | ||
speed: 1, | ||
growthFactor: 1.002, | ||
growthFactor: 1, | ||
hotspot: false, | ||
@@ -11,0 +11,0 @@ }; |
@@ -13,2 +13,4 @@ const Random = require('./random.js'); | ||
bubbleFlutter: 0.1, | ||
bubbleGrowthFactorMin: 1, | ||
bubbleGrowthFactorRange: 0.002, | ||
bubbleOpacity: 0.7, | ||
@@ -43,2 +45,8 @@ bubbleRadiusMin: 1, | ||
let bubbleRadiusMax = this.bubbleRadiusMin + this.bubbleRadiusRange; | ||
this.xMin = -bubbleRadiusMax; | ||
this.xMax = this.width + bubbleRadiusMax; | ||
this.yMin = -bubbleRadiusMax; | ||
this.yMax = this.height + bubbleRadiusMax; | ||
this.generateBubbles(this.width * this.height * this.bubbleDensity); | ||
@@ -115,8 +123,9 @@ this.generateHotspots(0, this.width); | ||
this.bubbles.add(new Bubble({ | ||
x: options.x || Random.between(options.xMin || 0, this.width), | ||
y: options.replace ? this.height : Random.between(options.yMin || 0, this.height), | ||
x: options.x || Random.between(options.xMin || this.xMin, this.xMax), | ||
y: options.replace ? this.yMax : Random.between(options.yMin || this.yMin, this.yMax), | ||
flutter: this.bubbleFlutter, | ||
growthFactor: Random.between(0, this.bubbleGrowthFactorRange) + this.bubbleGrowthFactorMin, | ||
hotspot: !!options.hotspot, | ||
radius: Random.between(0, this.bubbleRadiusRange) + this.bubbleRadiusMin, | ||
speed: options.speed || Random.between(0, this.bubbleSpeedRange) + this.bubbleSpeedMin, | ||
hotspot: !!options.hotspot, | ||
flutter: this.bubbleFlutter, | ||
})); | ||
@@ -134,4 +143,4 @@ }; | ||
b.update(); | ||
if (b.y < -b.radius || b.x > this.width || b.y > this.height) { | ||
if (b.y < -b.radius && !b.hotspot) { | ||
if (b.y < this.yMin || b.x > this.xMax || b.y > this.yMax) { | ||
if (b.y < this.yMin && !b.hotspot) { | ||
this.generateBubble({ replace: true }); | ||
@@ -138,0 +147,0 @@ } |
{ | ||
"name": "carbonator", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Carbonate your web pages.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -40,2 +40,4 @@ # Carbonator | ||
| `bubbleFlutter` | maximum range bubble may move in either direction (px/frame) | `0.1` | | ||
| `bubbleGrowthFactorMin` | minimum bubble growth rate | `1` (no growth) | | ||
| `bubbleGrowthFactorMin` | possible bubble growth rate in excess of minimum | `0.002` | | ||
| `bubbleOpacity` | opacity of the bubbles | `0.7` | | ||
@@ -42,0 +44,0 @@ | `bubbleRadiusMin` | minimum range of each bubble (px) | `1` | |
11628
215
69