How to use math-clamp - 4 common examples

To help you get started, we’ve selected a few math-clamp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mickdekkers / vue-howler / src / index.js View on Github external
setProgress(progress) {
      if (typeof progress !== 'number') {
        throw new Error(
          `progress must be a number, got a ${typeof progress} instead`
        )
      }

      this.setSeek(clamp(progress, 0, 1) * this.duration)
    }
  }
github mickdekkers / vue-howler / src / index.js View on Github external
setRate(rate) {
      if (typeof rate !== 'number') {
        throw new Error(`rate must be a number, got a ${typeof rate} instead`)
      }

      this.$data._howl.rate(clamp(rate, 0.5, 4))
    },
    /**
github mickdekkers / vue-howler / src / index.js View on Github external
setSeek(seek) {
      if (typeof seek !== 'number') {
        throw new Error(`seek must be a number, got a ${typeof seek} instead`)
      }

      this.$data._howl.seek(clamp(seek, 0, this.duration))
    },
    /**
github mickdekkers / vue-howler / src / index.js View on Github external
setVolume(volume) {
      if (typeof volume !== 'number') {
        throw new Error(
          `volume must be a number, got a ${typeof volume} instead`
        )
      }

      this.$data._howl.volume(clamp(volume, 0, 1))
    },
    /**

math-clamp

Clamp a number

MIT
Latest version published 11 months ago

Package Health Score

56 / 100
Full package analysis

Popular math-clamp functions