# Plasma globe loader

> Plasma bolts crackle from the core of a glass sphere and gather where you bring your finger or cursor.

- Category: [Loaders](https://library.aimran.es/components/loaders)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-ld-plasma-globe
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

A plasma lamp drawn in SVG: seven filaments leave a glowing electrode and wander around the sphere, redrawn with fresh jitter many times a second by a short script. Move the pointer or a finger over the glass and three bolts snap to that point with a bright spot. It suits science museums, gaming sites and tech events.

The main color sets the bolts and the second the inner haze, so pink and blue can become green or amber. It reacts to mouse and touch, and with reduced motion it only redraws when the pointer moves.

## Code

### HTML

```html
<div class="uvq10-pls" role="status"><span class="sr">Loading</span><div class="gl" aria-hidden="true"><svg viewBox="-50 -50 100 100"><g class="fs"></g><circle class="cr" r="7"/><circle class="tp" r="3.2" cx="0" cy="-44"/></svg><i class="sh"></i></div><i class="bs" aria-hidden="true"></i></div>
```

### CSS

```css
.uvq10-pls {
  --c1: #ff5ccd;
  --c2: #5ab8ff;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq10-pls {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 8em;
}

.uvq10-pls .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.uvq10-pls .gl {
  position: relative;
  z-index: 1;
  width: 7.6em;
  height: 7.6em;
  border-radius: 50%;
  cursor: crosshair;
  touch-action: none;
  background: radial-gradient(circle,color-mix(in srgb,var(--c2) 30%,#0b0614),#06030c 72%);
  box-shadow: inset 0 0 1.2em color-mix(in srgb,var(--c2) 45%,transparent),0 0 1.8em -.3em color-mix(in srgb,var(--c1) 50%,transparent),0 0 0 1px rgba(255,255,255,.14);
}

.uvq10-pls svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.uvq10-pls .fs path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq10-pls .fs .g {
  stroke: var(--c1);
  stroke-width: 3;
  opacity: .4;
  filter: blur(1.4px);
}

.uvq10-pls .fs .c {
  stroke: color-mix(in srgb,var(--c1) 35%,#fff);
  stroke-width: .8;
}

.uvq10-pls .cr {
  fill: color-mix(in srgb,var(--c1) 30%,#fff);
  filter: drop-shadow(0 0 3px var(--c1)) drop-shadow(0 0 7px var(--c2));
}

.uvq10-pls .tp {
  fill: #fff;
  opacity: 0;
  filter: drop-shadow(0 0 3px var(--c1)) drop-shadow(0 0 6px var(--c1));
  transition: opacity calc(0.2s / var(--k));
}

.uvq10-pls.on .tp {
  opacity: 1;
}

.uvq10-pls .sh {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 24%,rgba(255,255,255,.38),transparent 20%),radial-gradient(circle at 70% 82%,rgba(255,255,255,.08),transparent 30%);
  pointer-events: none;
}

.uvq10-pls .bs {
  width: 4.8em;
  height: 1.7em;
  margin-top: -.55em;
  border-radius: 0 0 .4em .4em;
  background: linear-gradient(#34343a,#101013);
  clip-path: polygon(16% 0,84% 0,100% 100%,0 100%);
  box-shadow: inset 0 .3em .3em -.1em color-mix(in srgb,var(--c1) 40%,transparent);
}

@media (prefers-reduced-motion:reduce) {
  .uvq10-pls,.uvq10-pls *,.uvq10-pls *::before,.uvq10-pls *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq10-pls").forEach(el => {
  const k=parseFloat(getComputedStyle(el).getPropertyValue('--k'))||1;const rm=matchMedia('(prefers-reduced-motion: reduce)').matches;
const NS='http://www.w3.org/2000/svg',fs=el.querySelector('.fs'),tp=el.querySelector('.tp'),gl=el.querySelector('.gl');
const ps=[];
for(let i=0;i<7;i++){const g=document.createElementNS(NS,'path'),c=document.createElementNS(NS,'path');g.setAttribute('class','g');c.setAttribute('class','c');fs.append(g,c);ps.push({g,c,a:i*Math.PI*2/7,w:.4+Math.random()*.6,ph:Math.random()*6});}
let tgt=null,t=0,iv=0;
const draw=()=>{t+=.05*k;ps.forEach((p,i)=>{let a=p.a+Math.sin(t*p.w+p.ph)*.5+t*.08;if(tgt!==null){const d=Math.atan2(Math.sin(tgt-a),Math.cos(tgt-a));a+=d*(i<3?1:.35);}let s='M0 0';for(let j=1;j<=8;j++){const r=6+38*j/8,q=(Math.random()-.5)*j*(j===8&&tgt!==null&&i<3?0:1.1);s+=' L'+(Math.cos(a)*r-Math.sin(a)*q).toFixed(1)+' '+(Math.sin(a)*r+Math.cos(a)*q).toFixed(1);}p.g.setAttribute('d',s);p.c.setAttribute('d',s);});if(tgt!==null){tp.setAttribute('cx',(Math.cos(tgt)*44).toFixed(1));tp.setAttribute('cy',(Math.sin(tgt)*44).toFixed(1));}};
const mv=(e)=>{const b=gl.getBoundingClientRect();tgt=Math.atan2(e.clientY-(b.top+b.height/2),e.clientX-(b.left+b.width/2));el.classList.add('on');if(rm)draw();};
const lv=()=>{tgt=null;el.classList.remove('on');if(rm)draw();};
const up=(e)=>{if(e.pointerType!=='mouse')lv();};
gl.addEventListener('pointermove',mv);gl.addEventListener('pointerdown',mv);gl.addEventListener('pointerleave',lv);gl.addEventListener('pointerup',up);gl.addEventListener('pointercancel',lv);
draw();if(!rm)iv=setInterval(draw,60);
return()=>{clearInterval(iv);gl.removeEventListener('pointermove',mv);gl.removeEventListener('pointerdown',mv);gl.removeEventListener('pointerleave',lv);gl.removeEventListener('pointerup',up);gl.removeEventListener('pointercancel',lv);};
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq10-pls {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 8em;
}

.uvq10-pls .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.uvq10-pls .gl {
  position: relative;
  z-index: 1;
  width: 7.6em;
  height: 7.6em;
  border-radius: 50%;
  cursor: crosshair;
  touch-action: none;
  background: radial-gradient(circle,color-mix(in srgb,var(--c2) 30%,#0b0614),#06030c 72%);
  box-shadow: inset 0 0 1.2em color-mix(in srgb,var(--c2) 45%,transparent),0 0 1.8em -.3em color-mix(in srgb,var(--c1) 50%,transparent),0 0 0 1px rgba(255,255,255,.14);
}

.uvq10-pls svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.uvq10-pls .fs path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq10-pls .fs .g {
  stroke: var(--c1);
  stroke-width: 3;
  opacity: .4;
  filter: blur(1.4px);
}

.uvq10-pls .fs .c {
  stroke: color-mix(in srgb,var(--c1) 35%,#fff);
  stroke-width: .8;
}

.uvq10-pls .cr {
  fill: color-mix(in srgb,var(--c1) 30%,#fff);
  filter: drop-shadow(0 0 3px var(--c1)) drop-shadow(0 0 7px var(--c2));
}

.uvq10-pls .tp {
  fill: #fff;
  opacity: 0;
  filter: drop-shadow(0 0 3px var(--c1)) drop-shadow(0 0 6px var(--c1));
  transition: opacity calc(0.2s / var(--k));
}

.uvq10-pls.on .tp {
  opacity: 1;
}

.uvq10-pls .sh {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 24%,rgba(255,255,255,.38),transparent 20%),radial-gradient(circle at 70% 82%,rgba(255,255,255,.08),transparent 30%);
  pointer-events: none;
}

.uvq10-pls .bs {
  width: 4.8em;
  height: 1.7em;
  margin-top: -.55em;
  border-radius: 0 0 .4em .4em;
  background: linear-gradient(#34343a,#101013);
  clip-path: polygon(16% 0,84% 0,100% 100%,0 100%);
  box-shadow: inset 0 .3em .3em -.1em color-mix(in srgb,var(--c1) 40%,transparent);
}

@media (prefers-reduced-motion:reduce) {
  .uvq10-pls,.uvq10-pls *,.uvq10-pls *::before,.uvq10-pls *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const k=parseFloat(getComputedStyle(el).getPropertyValue('--k'))||1;const rm=matchMedia('(prefers-reduced-motion: reduce)').matches;
const NS='http://www.w3.org/2000/svg',fs=el.querySelector('.fs'),tp=el.querySelector('.tp'),gl=el.querySelector('.gl');
const ps=[];
for(let i=0;i<7;i++){const g=document.createElementNS(NS,'path'),c=document.createElementNS(NS,'path');g.setAttribute('class','g');c.setAttribute('class','c');fs.append(g,c);ps.push({g,c,a:i*Math.PI*2/7,w:.4+Math.random()*.6,ph:Math.random()*6});}
let tgt=null,t=0,iv=0;
const draw=()=>{t+=.05*k;ps.forEach((p,i)=>{let a=p.a+Math.sin(t*p.w+p.ph)*.5+t*.08;if(tgt!==null){const d=Math.atan2(Math.sin(tgt-a),Math.cos(tgt-a));a+=d*(i<3?1:.35);}let s='M0 0';for(let j=1;j<=8;j++){const r=6+38*j/8,q=(Math.random()-.5)*j*(j===8&&tgt!==null&&i<3?0:1.1);s+=' L'+(Math.cos(a)*r-Math.sin(a)*q).toFixed(1)+' '+(Math.sin(a)*r+Math.cos(a)*q).toFixed(1);}p.g.setAttribute('d',s);p.c.setAttribute('d',s);});if(tgt!==null){tp.setAttribute('cx',(Math.cos(tgt)*44).toFixed(1));tp.setAttribute('cy',(Math.sin(tgt)*44).toFixed(1));}};
const mv=(e)=>{const b=gl.getBoundingClientRect();tgt=Math.atan2(e.clientY-(b.top+b.height/2),e.clientX-(b.left+b.width/2));el.classList.add('on');if(rm)draw();};
const lv=()=>{tgt=null;el.classList.remove('on');if(rm)draw();};
const up=(e)=>{if(e.pointerType!=='mouse')lv();};
gl.addEventListener('pointermove',mv);gl.addEventListener('pointerdown',mv);gl.addEventListener('pointerleave',lv);gl.addEventListener('pointerup',up);gl.addEventListener('pointercancel',lv);
draw();if(!rm)iv=setInterval(draw,60);
return()=>{clearInterval(iv);gl.removeEventListener('pointermove',mv);gl.removeEventListener('pointerdown',mv);gl.removeEventListener('pointerleave',lv);gl.removeEventListener('pointerup',up);gl.removeEventListener('pointercancel',lv);};
}

export default function LdPlasmaGlobe() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#ff5ccd",
          "--c2": "#5ab8ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq10-pls" role="status"><span className="sr">Loading</span><div className="gl" aria-hidden="true"><svg viewBox="-50 -50 100 100"><g className="fs"></g><circle className="cr" r="7" /><circle className="tp" r="3.2" cx="0" cy="-44" /></svg><i className="sh"></i></div><i className="bs" aria-hidden="true"></i></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Plasma globe loader” block (Loaders) from AIMRAN Library to my project.

## What it is
Plasma bolts crackle from the core of a glass sphere and gather where you bring your finger or cursor.

## Chosen settings
- Main color: #ff5ccd
- Secondary color: #5ab8ff
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq10-pls {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 8em;
}

.uvq10-pls .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.uvq10-pls .gl {
  position: relative;
  z-index: 1;
  width: 7.6em;
  height: 7.6em;
  border-radius: 50%;
  cursor: crosshair;
  touch-action: none;
  background: radial-gradient(circle,color-mix(in srgb,var(--c2) 30%,#0b0614),#06030c 72%);
  box-shadow: inset 0 0 1.2em color-mix(in srgb,var(--c2) 45%,transparent),0 0 1.8em -.3em color-mix(in srgb,var(--c1) 50%,transparent),0 0 0 1px rgba(255,255,255,.14);
}

.uvq10-pls svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.uvq10-pls .fs path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq10-pls .fs .g {
  stroke: var(--c1);
  stroke-width: 3;
  opacity: .4;
  filter: blur(1.4px);
}

.uvq10-pls .fs .c {
  stroke: color-mix(in srgb,var(--c1) 35%,#fff);
  stroke-width: .8;
}

.uvq10-pls .cr {
  fill: color-mix(in srgb,var(--c1) 30%,#fff);
  filter: drop-shadow(0 0 3px var(--c1)) drop-shadow(0 0 7px var(--c2));
}

.uvq10-pls .tp {
  fill: #fff;
  opacity: 0;
  filter: drop-shadow(0 0 3px var(--c1)) drop-shadow(0 0 6px var(--c1));
  transition: opacity calc(0.2s / var(--k));
}

.uvq10-pls.on .tp {
  opacity: 1;
}

.uvq10-pls .sh {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 24%,rgba(255,255,255,.38),transparent 20%),radial-gradient(circle at 70% 82%,rgba(255,255,255,.08),transparent 30%);
  pointer-events: none;
}

.uvq10-pls .bs {
  width: 4.8em;
  height: 1.7em;
  margin-top: -.55em;
  border-radius: 0 0 .4em .4em;
  background: linear-gradient(#34343a,#101013);
  clip-path: polygon(16% 0,84% 0,100% 100%,0 100%);
  box-shadow: inset 0 .3em .3em -.1em color-mix(in srgb,var(--c1) 40%,transparent);
}

@media (prefers-reduced-motion:reduce) {
  .uvq10-pls,.uvq10-pls *,.uvq10-pls *::before,.uvq10-pls *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const k=parseFloat(getComputedStyle(el).getPropertyValue('--k'))||1;const rm=matchMedia('(prefers-reduced-motion: reduce)').matches;
const NS='http://www.w3.org/2000/svg',fs=el.querySelector('.fs'),tp=el.querySelector('.tp'),gl=el.querySelector('.gl');
const ps=[];
for(let i=0;i<7;i++){const g=document.createElementNS(NS,'path'),c=document.createElementNS(NS,'path');g.setAttribute('class','g');c.setAttribute('class','c');fs.append(g,c);ps.push({g,c,a:i*Math.PI*2/7,w:.4+Math.random()*.6,ph:Math.random()*6});}
let tgt=null,t=0,iv=0;
const draw=()=>{t+=.05*k;ps.forEach((p,i)=>{let a=p.a+Math.sin(t*p.w+p.ph)*.5+t*.08;if(tgt!==null){const d=Math.atan2(Math.sin(tgt-a),Math.cos(tgt-a));a+=d*(i<3?1:.35);}let s='M0 0';for(let j=1;j<=8;j++){const r=6+38*j/8,q=(Math.random()-.5)*j*(j===8&&tgt!==null&&i<3?0:1.1);s+=' L'+(Math.cos(a)*r-Math.sin(a)*q).toFixed(1)+' '+(Math.sin(a)*r+Math.cos(a)*q).toFixed(1);}p.g.setAttribute('d',s);p.c.setAttribute('d',s);});if(tgt!==null){tp.setAttribute('cx',(Math.cos(tgt)*44).toFixed(1));tp.setAttribute('cy',(Math.sin(tgt)*44).toFixed(1));}};
const mv=(e)=>{const b=gl.getBoundingClientRect();tgt=Math.atan2(e.clientY-(b.top+b.height/2),e.clientX-(b.left+b.width/2));el.classList.add('on');if(rm)draw();};
const lv=()=>{tgt=null;el.classList.remove('on');if(rm)draw();};
const up=(e)=>{if(e.pointerType!=='mouse')lv();};
gl.addEventListener('pointermove',mv);gl.addEventListener('pointerdown',mv);gl.addEventListener('pointerleave',lv);gl.addEventListener('pointerup',up);gl.addEventListener('pointercancel',lv);
draw();if(!rm)iv=setInterval(draw,60);
return()=>{clearInterval(iv);gl.removeEventListener('pointermove',mv);gl.removeEventListener('pointerdown',mv);gl.removeEventListener('pointerleave',lv);gl.removeEventListener('pointerup',up);gl.removeEventListener('pointercancel',lv);};
}

export default function LdPlasmaGlobe() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#ff5ccd",
          "--c2": "#5ab8ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq10-pls" role="status"><span className="sr">Loading</span><div className="gl" aria-hidden="true"><svg viewBox="-50 -50 100 100"><g className="fs"></g><circle className="cr" r="7" /><circle className="tp" r="3.2" cx="0" cy="-44" /></svg><i className="sh"></i></div><i className="bs" aria-hidden="true"></i></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
