search
/
·
Intro
expand_more
Guides
·
Getting started
·
WebGPU canvas
·
2D canvas
·
Drawing and animation
·
Scene geometry
·
2D and 3D plot
·
Data-driven geometry
·
Events and Picking
·
Live vs React
·
Memoization
·
WGSL Shaders
·
Renderers and Passes
·
Layout and UI
·
Background
·
Roadmap
·
Contributing
Reference
expand_more
Components
chevron_right
@use-gpu/2d-canvas
chevron_right
@use-gpu/2d-plot
expand_more
@use-gpu/frame
widgets
Animate
widgets
Await
widgets
Clock
widgets
CursorProvider
widgets
DOMEvents
widgets
EaseToTarget
widgets
EventProvider
widgets
Fetch
widgets
Queue
widgets
Router
widgets
Routes
widgets
Sampler
widgets
Suspense
widgets
SyncLoop
widgets
Tensor
phishing
useAnimationFrame
phishing
useBufferedSize
phishing
useCanvasEvents
phishing
useDataContext
phishing
useEventEffect
phishing
useForceUpdate
phishing
useInspectable
phishing
useInspectHoverable
phishing
useInspectorSelect
phishing
useKeyboardState
phishing
useLayoutContext
phishing
useMouseState
phishing
useNoAnimationFrame
phishing
useNoBufferedSize
phishing
useNoInspectable
phishing
useNoInspectHoverable
phishing
useNoKeyboardState
phishing
useNoMouseState
phishing
useNoPerFrame
phishing
useNoPerViewFrame
phishing
useNoPickingId
phishing
useNoPickingIds
phishing
useNoRangeContext
phishing
useNoRenderContext
phishing
useNoSuspenseContext
phishing
useNoTimeContext
phishing
useNoWheelState
phishing
useObjectEvents
phishing
usePerFrame
phishing
usePerViewFrame
phishing
usePickingId
phishing
usePickingIds
phishing
usePointerCapture
phishing
usePointerLock
phishing
useRangeContext
phishing
useRenderContext
phishing
useRouterContext
phishing
useSuspenseContext
phishing
useTimeContext
phishing
useWheelState
east
adjustBufferedSize
east
automaticKeyframes
east
cloneLerpable
east
copyLerpable
east
EventStateProvider
east
getCPUConcurrency
east
makeBasedURL
east
makeBrowserHistory
east
makeRelativeURL
east
makeWorkerDispatch
east
Outlet
east
pathSpecToRegexp
input
DataContext
input
EventContext
input
KeyboardContext
input
LayoutContext
input
LoopContext
input
MouseContext
input
RangeContext
input
RenderContext
input
RouteContext
input
RouterContext
input
SuspenseContext
input
TimeContext
input
ViewFrameContext
input
WheelContext
data_object
CursorState
data_object
DOM_EVENT_PROPS
data_object
EaseTypes
data_object
EventReconciler
data_object
QueueReconciler
title
AutoKeyframe
title
AutoSpline
title
CanvasEvent
title
DataContextProps
title
Dispatcher
title
Ease
title
EaseType
title
EaseTypeImpl
title
EventBinding
title
EventCallback
title
EventContextProps
title
EventHandler
title
EventStateProviderProps
title
FetchAPIOptions
title
GenericRenderContext
title
Inspector
title
KeyboardEvent
title
KeyboardModifier
title
KeyboardState
title
Keyframe
title
KeyframeTypeOf
title
Lerp
title
Lerpable
title
LerpableRecord
title
LoopContextProps
title
MakeSpline
title
Measure
title
MouseButton
title
MouseState
title
PickRef
title
PointerCaptureAPI
title
PointerEvent
title
PointerLockAPI
title
QueryParams
title
RangeContextProps
title
Route
title
RouterAPI
title
RouterLink
title
RouterState
title
RouteState
title
Spline
title
SyncLoopRef
title
TimeContextProps
title
Tracks
title
TrackTypes
title
ViewFrameContextProps
title
WheelEvent
title
WheelState
chevron_right
@use-gpu/gltf
chevron_right
@use-gpu/inspect
chevron_right
@use-gpu/inspect-gpu
chevron_right
@use-gpu/interact
chevron_right
@use-gpu/layout
chevron_right
@use-gpu/map
chevron_right
@use-gpu/plot
chevron_right
@use-gpu/present
chevron_right
@use-gpu/react
chevron_right
@use-gpu/scene
chevron_right
@use-gpu/voxel
chevron_right
@use-gpu/webgpu
chevron_right
@use-gpu/workbench
chevron_right
Libraries
chevron_right
Live/React
chevron_right
Loaders
chevron_right
Development

widgets Component – <Sampler>

const Sampler: LiveComponent<SamplerProps<string | string[]>>

Up-to-4D array of a WGSL type. Samples a given expr on the given range.

Props

size?
number[]

Sample count up to [width, height, depth, layers]

length?
number

Shorthand for size=[length]

axis?
string

Axis to sample on (1D)

axes?
string

Axes to sample on (2D+)

origin?
VectorLike

Sample origin to maintain alignment to

format?
string

WGSL type per sample

expr?
Emitter

Input emitter expression

range?
([number, number])[]

Input range to sample on each axis. Use RangeContext if omitted.

padding?
number

Extra padding samples to add outside the input range.

items?
number

Emit N items per expr call. Output size is [items, ...size] if > 1.

sparse?
boolean

Emit 0 or N items per expr call. Output size is [N] or [items, N].

centered?
boolean[] | boolean

Use centered samples (0.5, 1.5, ..., N-0.5) instead of edge-to-edge samples (0, 1, ..., N).

index?
boolean

Add current indices i, j, k, l to the expr arguments.

time?
boolean

Add current TimeContext to the expr arguments.

live?
boolean

Resample data or expr on every animation frame.

as?
S

Inject into DataContext under this key(s) render?

S
extends
any[]
?
(
  data: Record<ElementType<S>, TensorArray>,
) => LiveElement
:
(data: TensorArray) => LiveElement

children?

| LiveElement
| S extends any[] ? (data: Record<ElementType<S>, TensorArray>) => LiveElement : (data: TensorArray) => LiveElement

Source

packages / frame / src / emitters / sampler.ts

menu
format_list_numbered