MCPcopy Create free account
hub / github.com/codecombat/codecombat / fadeTrack

Function fadeTrack

app/core/store/modules/audio.js:412–422  ·  view source on GitHub ↗

* Fades a track between two volumes. * * @param opts {object} * @param opts.track {string} track to fade * @param opts.from {number|undefined} start volume between 0 and 1 * @param opts.to {number} finish volume between 0 and 1 * @param opts.duration {number} duration o

({ state, dispatch }, { track, from, to, duration })

Source from the content-addressed store, hash-verified

410 * @throws {Error} when invalid track specified
411 */
412 fadeTrack ({ state, dispatch }, { track, from, to, duration }) {
413 const trackData = state.tracks[track]
414 if (!trackData) {
415 throw new Error('Invalid track specified')
416 }
417
418 const fades = Array.from(trackData.keys())
419 .map(id => dispatch('fadeSound', { id, from, to, duration }))
420
421 return Promise.all(fades)
422 },
423
424 /**
425 * Fades a sound between two volumes.

Callers

nothing calls this directly

Calls 1

dispatchFunction · 0.85

Tested by

no test coverage detected