Ring
A control evoking the focus ring on a proper camera lens.
Similar in functionality to a <Slider>.
Integrates the Ring control from Tweakpane-creator Hiroki Kokubun's CameraKit plugin.
Usage outside of a <Pane> component will implicitly wrap the ring in <Pane position="inline">.
Note that Svelte Tweakpane UI embeds a functionally identical fork of the plugin with build optimizations. The fork also changes the package name from @tweakpane/plugin-camerakit to @kitschpatrol/tweakpane-plugin-camerakit for consistency with other plugins.
<script lang="ts"> import { Ring, type RingUnit } from 'svelte-tweakpane-ui'
let unitConfig: RingUnit = { value: 20, pixels: 40, ticks: 5, }
let angle = 45</script>
<Ring bind:value={angle} format={(v) => `${(Math.abs(v) % 360).toFixed(0)}°`} pointerScale={-2.5} unit={unitConfig} wide={true}/>
<div class="demo" style:--a="{angle}deg"></div>
<style> div.demo { aspect-ratio: 1; width: 100%; background: linear-gradient(var(--a), magenta, orange); }</style>| bindablerequired | |
| Description | A |
|---|---|
| Type | number |
| optional | |
| Description | Style variations. |
|---|---|
| Type | RingSeries |
| Default | 0 |
| optional | |
| Description | Density and value mapping of the ring's tick marks. |
|---|---|
| Type | RingUnit |
| Default | { ticks: 5, pixels: 40, value: 10 } |
| optional | |
| Description | Prevent interactivity and gray out the control. |
|---|---|
| Type | boolean |
| Default | false |
| optional | |
| Description | Text displayed next to control. |
|---|---|
| Type | string |
| Default | undefined |
| optional | |
| Description | Custom color scheme. |
|---|---|
| Type | Theme |
| Default | undefinedInherits default Tweakpane theme equivalent to ThemeUtils.presets.standard, or the theme set with setGlobalDefaultTheme(). |
| optional | |
| Description | Minimum value. Specifying both a |
|---|---|
| Type | number |
| Default | undefined |
| optional | |
| Description | Maximum value. Specifying both a |
|---|---|
| Type | number |
| Default | undefined |
| optional | |
| Description | The minimum step interval. |
|---|---|
| Type | number |
| Default | undefinedNo step constraint. |
| optional | |
| Description | The unit scale for pointer-based input for all dimensions. |
|---|---|
| Type | number |
| Default | undefinedDynamic based on magnitude of value. |
| optional | |
| Description | The unit scale for key-based input for all dimensions (e.g. the up and down arrow keys). |
|---|---|
| Type | number |
| Default | 1Or stepValue if defined. |
| optional | |
| Description | A function to customize the point value's string representation (e.g. rounding, etc.). |
|---|---|
| Type | ((value: number) => string) |
| Default | undefinedNormal .toString() formatting. |
| optional | |
| Description | When |
|---|---|
| Type | boolean |
| Default | false |
| Description | Fires when This event is provided for advanced use cases. It's usually preferred to bind to the The |
|---|---|
| Extends | ValueChangeEvent |
| Type | RingChangeEvent |