Ellipse

타원

Create an oval by adjusting its horizontal and vertical radii independently.

Also known as: EllipseOval

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, Ellipse } from 'shaders/react'

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

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

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

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <Ellipse />
    </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: 'Ellipse',
    }
  ]
}, { disableTelemetry: true })

Props · Ellipse

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

NameValueDefaultRange / optionsDescription
originOriginSet in codecenter—Reference edge the center position is measured from (center default). Lets you pin the shape relative to a corner or the canvas centre.
colorColor#ffffff—Fill color of the ellipse
centerCenter
x0.5y0.5
{"x":0.5,"y":0.5}x, y: 0 – 1Center position of the ellipse
radiusXWidth0.350.01 – 1 (step 0.01)Horizontal semi-axis radius
radiusYHeight0.20.01 – 1 (step 0.01)Vertical semi-axis radius
rotationRotation00 – 360 (step 1)Rotation in degrees
softnessSoftness00 – 0.1 (step 0.001)Edge softness for antialiasing
strokeThicknessStroke Thickness00 – 0.2 (step 0.005)Stroke thickness. Zero means no stroke.
strokeColorStroke Color#000000—Color of the stroke outline
strokePositionStroke Positioncenteroutside · center · insidePosition of the stroke relative to the shape edge
colorSpaceColor Blendinglinearlinear · oklch · oklab · hsl · hsv · lchColor space for blending fill and stroke colors

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

An ellipse looks like a circle pressed or stretched in one direction. It suits places that need more direction than a circle, such as a pill-like accent or an oval highlight.

`radiusX` and `radiusY` set the horizontal and vertical radii independently, both from 0.01 to 1. Use `rotation` from 0 to 360 degrees to change its orientation, and `softness` from 0 to 0.1 to soften the edge.

Equal horizontal and vertical radii make it look circular, so use different values for an elongated shape. Layer it over a background or cross several ellipses to create orbit- or lens-like graphics.

When to use

Use it for oval accents, the base of a light highlight, or orbit- and lens-like graphics. It can also create a directional emphasis that a circle cannot. Avoid it when the radius must be equal in every direction; use Circle instead.

Open as page ↗