@urso/core 0.7.28 → 0.7.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ class SoundSprite {
|
|
|
60
60
|
|
|
61
61
|
if (!soundState)
|
|
62
62
|
return Urso.logger.error(`SoundSprite error: soundState for id '${id}' not found!`);
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
if (!soundState.loop)
|
|
65
65
|
soundState.id = null;
|
|
66
66
|
});
|
|
@@ -84,7 +84,7 @@ class SoundSprite {
|
|
|
84
84
|
|
|
85
85
|
this.setRelaunch(soundKey, relaunch);
|
|
86
86
|
this.setLoop(soundKey, loop);
|
|
87
|
-
this.setVolume(soundKey, volume);
|
|
87
|
+
this.setVolume({ soundKey, volume });
|
|
88
88
|
|
|
89
89
|
return true;
|
|
90
90
|
};
|
|
@@ -94,17 +94,17 @@ class SoundSprite {
|
|
|
94
94
|
this._player.loop(loop, this._soundsState[soundKey].id);
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
setVolume(soundKey, volume = 1, saveVolumeState = true) {
|
|
97
|
+
setVolume({ soundKey, volume = 1, saveVolumeState = true }) {
|
|
98
98
|
this._player.volume(volume, this._soundsState[soundKey].id);
|
|
99
|
-
|
|
100
|
-
if(volume === 0) {
|
|
99
|
+
|
|
100
|
+
if (volume === 0) {
|
|
101
101
|
this._changeSoundMute(true, soundKey);
|
|
102
102
|
return;
|
|
103
|
-
}else if(this._soundsState[soundKey]._muted) {
|
|
103
|
+
} else if (this._soundsState[soundKey]._muted) {
|
|
104
104
|
this._changeSoundMute(false, soundKey);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
if(saveVolumeState) {
|
|
107
|
+
if (saveVolumeState) {
|
|
108
108
|
this._soundsState[soundKey].volume = volume;
|
|
109
109
|
}
|
|
110
110
|
};
|
|
@@ -123,7 +123,7 @@ class SoundSprite {
|
|
|
123
123
|
this._player._volume = this._totalVolume;
|
|
124
124
|
soundKeys.forEach(soundKey => {
|
|
125
125
|
const soundVolume = this._soundsState[soundKey].volume * this._totalVolume;
|
|
126
|
-
this.setVolume(soundKey, soundVolume, false);
|
|
126
|
+
this.setVolume({ soundKey, volume: soundVolume, saveVolumeState: false });
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -161,7 +161,7 @@ class SoundSprite {
|
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
_stopPrevFade(soundKey) {
|
|
164
|
-
if(this._fadeTweens[soundKey]) {
|
|
164
|
+
if (this._fadeTweens[soundKey]) {
|
|
165
165
|
this._fadeTweens[soundKey].kill();
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -173,18 +173,18 @@ class SoundSprite {
|
|
|
173
173
|
const delta = fadeTo - fadeFrom;
|
|
174
174
|
|
|
175
175
|
const onUpdate = () => {
|
|
176
|
-
const volume
|
|
177
|
-
this.setVolume(soundKey, volume);
|
|
176
|
+
const volume = (fadeFrom + (delta * this._fadeTweens[soundKey].ratio)) * this._totalVolume;
|
|
177
|
+
this.setVolume({ soundKey, volume });
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
this._fadeTweens[soundKey] = gsap.to({}, fadeDuration / 1000, { onUpdate });
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
fade({ fadeTo = 1, fadeDuration = 200, startSound = false, soundKey, ...others }) {
|
|
184
|
-
if(startSound) {
|
|
184
|
+
if (startSound) {
|
|
185
185
|
this.play({ ...others, soundKey });
|
|
186
186
|
}
|
|
187
|
-
if(this._soundsState[soundKey].id === null) {
|
|
187
|
+
if (this._soundsState[soundKey].id === null) {
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
|