melonjs
    Preparing search index...

    Function vibrate

    • the vibrate method pulses the vibration hardware on the device,
      If the device doesn't support vibration, this method has no effect.
      If a vibration pattern is already in progress when this method is called, the previous pattern is halted and the new one begins instead.

      Parameters

      • pattern: number | number[]

        pattern of vibration and pause intervals

      Returns void

      device

      // vibrate for 1000 ms
      me.device.vibrate(1000);
      // or alternatively
      me.device.vibrate([1000]);
      // vibrate for 50 ms, be still for 100 ms, and then vibrate for 150 ms:
      me.device.vibrate([50, 100, 150]);
      // cancel any existing vibrations
      me.device.vibrate(0);