Radial Gradient

원형 그라디언트

A gradient that spreads outward from a center point.

Also known as: RadialGradientCircular gradient

Moves in browsers that support WebGPU

This device could not render the demo — showing a still

React
// Renders only in browsers with WebGPU.
import { Shader, RadialGradient } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <RadialGradient />
    </Shader>
  )
}
Vue
<!-- Renders only in browsers with WebGPU. -->
<script setup lang="ts">
import { Shader, RadialGradient } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <RadialGradient/>
  </Shader>
</template>
Svelte
<!-- Renders only in browsers with WebGPU. -->
<script>
  import { Shader, RadialGradient } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <RadialGradient />
</Shader>
Solid
// Renders only in browsers with WebGPU.
import { Shader, RadialGradient } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <RadialGradient />
    </Shader>
  )
}
JavaScript
// Renders only in browsers with WebGPU.
// expects <canvas id="canvas" style="width:100%;height:320px"></canvas> on the page
import { createShader } from 'shaders/js'

const shader = await createShader(document.getElementById("canvas"), {
  components: [
    {
      type: 'RadialGradient',
    }
  ]
}, { disableTelemetry: true })

Props · RadialGradient

Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).

NameValueDefaultRange / optionsDescription
colorAColor A#ff0000—The starting color at the center of the gradient
colorBColor B#0000ff—The ending color at the edge of the gradient
stopsColorsSet in codenull—Multi-stop gradient colors (overrides Color A / Color B when set)
centerCenter
x0.5y0.5
{"x":0.5,"y":0.5}x, y: 0 – 1The center point of the radial gradient
radiusRadius10 – 2 (step 0.1)The radius of the gradient (normalized, 0.0-1.0)
repeatRepeat11 – 20 (step 0.5)Number of times the gradient repeats. Values above 1 create concentric rings.
aspectAspect10.1 – 4 (step 0.01)Stretches the gradient into an ellipse. Values below 1 compress vertically, above 1 compress horizontally.
skewAngleSkew Angle00 – 360 (step 1)Rotates the ellipse axis in degrees. Only visible when Aspect is not 1.
colorSpaceColor Spacelinearlinear · oklch · oklab · hsl · hsv · lchColor space for color interpolation

Every component also takes blendMode · opacity · visible · maskSource/maskType · boundingBox · id

Like ink spreading in a pool of water, the color moves outward from a center. It creates a glow-like background or a clearly centered field of color.

`colorA` is the center color and `colorB` is the outer color. Move `center` to move the origin; increase `radius` to carry the transition farther across the canvas (default 1, range 0–2). Set `repeat` above 1 to add concentric bands (default 1, range 1–20).

This layer fills the canvas by itself and needs no input beneath it. Moving the center to an edge can concentrate the brightest area there, so check contrast where text will sit. Too many repeated bands can compete with the content.

When to use

Use it for an off-center glow, a focused color field, or concentric rings. Avoid it when repeated bands would compete with body text.

Open as page ↗