Skip to content
Sponsored by

MagicNoise ​

MagicNoise is a rendition of pixelated static noise, as seen on TV in the 90s.

<template>
  <magic-noise class="aspect-[16/10] w-full" />
</template>

Overview ​

Anatomy ​

vue
<template>
  <magic-noise />
</template>

Installation ​

CLI ​

Add @maas/vue-equipment to your dependencies.

sh
pnpm install @maas/vue-equipment
sh
npm install @maas/vue-equipment
sh
yarn add @maas/vue-equipment
sh
bun install @maas/vue-equipment

Vue ​

If you are using Vue, import and add MagicNoisePlugin to your app.

js
import { createApp } from 'vue'
import { MagicNoisePlugin } from '@maas/vue-equipment/plugins/MagicNoise'

const app = createApp({})

app.use(MagicNoisePlugin)

Nuxt ​

The component is available as a Nuxt module. In your Nuxt config file add @maas/vue-equipment/nuxt to your modules and add MagicNoise to the plugins in your configuration.

js
export default defineNuxtConfig({
  modules: ['@maas/vue-equipment/nuxt'],
  vueEquipment: {
    plugins: ['MagicNoise'],
  },
})

Direct Import ​

If you prefer a more granular approach, the component can also be directly imported into any Vue component.

vue
<script setup>
import { MagicNoise } from '@maas/vue-equipment/plugins/MagicNoise'
</script>

<template>
  <magic-noise />
</template>

Peer Dependencies ​

If you haven’t installed the required peer dependencies automatically, you’ll need to install the following packages manually.

Installation ​

sh
pnpm install @nuxt/kit @vueuse/core defu
sh
npm install @nuxt/kit @vueuse/core defu
sh
yarn add @nuxt/kit @vueuse/core defu
sh
bun install @nuxt/kit @vueuse/core defu

API Reference ​

Props ​

PropTypeRequired
options
MagicNoiseOptionsfalse
pause
booleanfalse

Options ​

To customize the component, override the necessary options. Any custom options will be merged with the default options.

OptionTypeDefault
pixelSize
number2
tiles
number32
fps
number12
color
stringwhite
alpha
booleanfalse
alpha
string
srgb

CSS Variables ​

The component comes with some CSS variables for customization.

VariableDefault
--magic-noise-background
#000
--magic-noise-loading-background#000
--magic-noise-loading-transitioncolor 300ms ease, opacity 300ms ease

Examples ​

Custom Color ​

<template>
  <magic-noise
    class="custom-color-noise aspect-[16/10] w-full"
    :options="{ color: '#46a758', alpha: true }"
  />
</template>

<style>
.custom-color-noise {
  --magic-noise-background: #1d3a24;
}
</style>