component
NeonStrip
A neon tube along local X: a white-hot core in a coloured sleeve with a soft halo, glowing at any hour. Decorative; light washes nearby walls in its colour through the world's light pool.
⌖ Explore the library in 3D → · View as Markdown
Add it
npx @runek/cli add neon-strip
Pulls @runek/core@^0.18.0.
Use it
import { NeonStrip } from './runek/NeonStrip'
<NeonStrip position={[0, 0, 0]} length={2} color="#2fd8ff" light={true} />
Or as a node in a world file (worlds as data):
{ "type": "NeonStrip", "props": { "position": [0, 0, 0], "length": 2, "color": "#2fd8ff", "light": true } }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
length |
number |
2 |
Length along local X, in units, centred on the origin. |
color |
color |
"#ff2fb3" |
The glow. |
thickness |
number |
0.03 |
Tube diameter, in units. |
light |
boolean |
false |
Cast real light as well as glowing, from the middle of the tube. Leave it off on most strips: the world lends real lights to only a few emitters at a time. |
intensity |
number |
3 |
The real light’s strength, with light. How bright the tube itself looks is the world’s tube luminance level. |
position |
[x, y, z] |
[0, 0, 0] |
Position [x, y, z] in units (1 unit = 1 m, Y-up). |
rotation |
[x, y, z] |
[0, 0, 0] |
Euler rotation [x, y, z] in radians. |
seed |
number |
Accepted for the component contract; this component has no seeded variation yet. |
Registry manifest
registry manifest /r/components/neon-strip.json Self-contained JSON: inlined source plus resolved dependencies, exactly whatrunek add neon-strip fetches.
Browse the whole catalog in the gallery →.
Source (NeonStrip.tsx)
import {
glowLook,
useLight,
useLuminance,
useMaterials,
useWorld,
type WorldComponentProps,
} from '@runek/core'
export interface NeonStripProps extends WorldComponentProps {
/** Length along local X, in units, centred on the origin. */
length?: number
/** The glow. */
color?: string
/** Tube diameter, in units. */
thickness?: number
/** Cast real light as well as glowing, from the middle of the tube. Leave it off on most
* strips: the world lends real lights to only a few emitters at a time. */
light?: boolean
/** The real light's strength, with `light`. How bright the tube itself looks is the world's
* `tube` luminance level. */
intensity?: number
}
/**
* A neon tube along local X: a white-hot core in a coloured sleeve with a soft halo, unlit by
* the scene so it reads as light at any hour, for cove lighting, a desk's edge or a line round
* a room, at the world's `tube` luminance level. `light` also washes nearby walls in its colour.
* Decorative: no collider.
*/
export function NeonStrip({
position = [0, 0, 0],
rotation = [0, 0, 0],
length = 2,
color = '#ff2fb3',
thickness = 0.03,
light = false,
intensity = 3,
}: NeonStripProps) {
const { unit } = useWorld()
const { tube } = useLuminance()
const L = length * unit
const r = (thickness / 2) * unit
const glow = useLight({ color, intensity, distance: (length + 3) * unit, decay: 1.6 }, light)
const m = useMaterials({
core: glowLook('#ffffff', tube),
sleeve: glowLook(color, tube, { transparent: true, opacity: 0.85 }),
halo: glowLook(color, tube, { transparent: true, opacity: 0.12, depthWrite: false }),
})
return (
<group position={position} rotation={rotation}>
<group rotation={[0, 0, Math.PI / 2]}>
<mesh material={m.core}>
<cylinderGeometry args={[r * 0.55, r * 0.55, L, 8]} />
</mesh>
<mesh material={m.sleeve}>
<cylinderGeometry args={[r, r, L, 12]} />
</mesh>
<mesh material={m.halo}>
<cylinderGeometry args={[r * 2.6, r * 2.6, L, 12]} />
</mesh>
</group>
<object3D ref={glow.ref} />
</group>
)
}