One Logo Pool Ball
wwwwwwwwwwwwwwwwwww

Effects

Edge fades, blur, and masks on native and web

Cross-platform effects under One.UI. The mask and blur modes render through the native primitives on iOS and Android. Web uses CSS masks and backdrop filters. Overlay mode paints through React Native core gradients on native and CSS gradients on web.

EdgeFade fades children toward the enabled edges. Each edge takes true, a size in dp, or { size, curve, color }. curve is a preset (smooth, smoother, sharp, gentle, soft, linear), a cubic bezier, or an alpha stop list. mode is mask (alpha fade, no color), overlay (color gradient over the children), or blur (progressive blur); the mode follows color when omitted, except blur which stays explicit. radius sets the corner radius; style.borderRadius is ignored.

Blur takes intensity (0 to 100, default 50) and tint. Mask takes a maskElement subtree whose opaque pixels show the content and whose transparent pixels hide it. The mask renders offscreen and must fill the whole view; anything but an element warns once and renders the children unmasked.

import { One } from 'one'
<One.UI.EdgeFade bottom={64} curve="smooth">
<LongList />
</One.UI.EdgeFade>
<One.UI.Blur intensity={60} tint="systemMaterial">
<OverlayCard />
</One.UI.Blur>

On web, Blur clamps intensity to 0–100 and maps it to a CSS backdrop blur radius of 0–20 pixels. Zero intensity paints no frost veil. Light and dark tints choose explicit veils; regular and unsuffixed system materials follow the browser color scheme. Material thickness changes the veil opacity. Children stay sharp above the backdrop. Browser materials approximate the native material meanings rather than UIKit’s exact pixels.

Web Mask uses CSS mask-image in alpha mode. The mounted mask subtree is hidden from sight, pointer input, and accessibility, then serialized with its computed styles into an SVG image. Opaque mask pixels reveal the content and transparent pixels reveal the background; the mask fills the content bounds. DOM or size changes update the image. External resources inside SVG images and continuous CSS animations are subject to browser image rendering restrictions. Invalid mask elements retain the warning and unmasked rendering contract.

Blur props

Blur also accepts React Native ViewProps, including children and accessibility props.

PropsTypeDescription
intensitynumber = 50Blur strength from 0 to 100. Values outside that range are clamped.
number = 50Blur strength from 0 to 100. Values outside that range are clamped.
tintBlurTint = "default"Native material name. Web approximates its tint with a frost veil.
BlurTint = "default"Native material name. Web approximates its tint with a frost veil.
styleStyleProp<ViewStyle>Container layout and styling. Give the effect explicit bounds.
StyleProp<ViewStyle>Container layout and styling. Give the effect explicit bounds.

BlurTint accepts light, dark, default, extraLight, regular, prominent, and the five system materials: systemUltraThinMaterial, systemThinMaterial, systemMaterial, systemThickMaterial, and systemChromeMaterial. Each system material also accepts a Light or Dark suffix. On iOS the material uses UIKit’s backdrop effect; children remain sharp.

EdgeFade props

EdgeFade also accepts React Native ViewProps. No edge is enabled by default. Enable an edge with true to use size, a number to set its depth, or an EdgeConfig object to set its depth and curve separately.

PropsTypeDescription
topboolean | number | EdgeConfigFade at the top edge.
boolean | number | EdgeConfigFade at the top edge.
bottomboolean | number | EdgeConfigFade at the bottom edge.
boolean | number | EdgeConfigFade at the bottom edge.
leftboolean | number | EdgeConfigFade at the left edge.
boolean | number | EdgeConfigFade at the left edge.
rightboolean | number | EdgeConfigFade at the right edge.
boolean | number | EdgeConfigFade at the right edge.
startboolean | number | EdgeConfigLeading edge for the current layout direction. Overrides its physical edge.
boolean | number | EdgeConfigLeading edge for the current layout direction. Overrides its physical edge.
endboolean | number | EdgeConfigTrailing edge for the current layout direction. Overrides its physical edge.
boolean | number | EdgeConfigTrailing edge for the current layout direction. Overrides its physical edge.
sizenumber = 80Default enabled-edge depth in dp.
number = 80Default enabled-edge depth in dp.
curveEdgeFadeCurve = "smooth"Default alpha or blur-envelope curve.
EdgeFadeCurve = "smooth"Default alpha or blur-envelope curve.
modeEdgeFadeModemask fades alpha; overlay paints color; blur softens edge content. Defaults to overlay when any edge has a color, otherwise mask.
EdgeFadeModemask fades alpha; overlay paints color; blur softens edge content. Defaults to overlay when any edge has a color, otherwise mask.
colorColorValueOverlay color, or an optional frost veil in blur mode. Ignored in mask mode.
ColorValueOverlay color, or an optional frost veil in blur mode. Ignored in mask mode.
blurRadiusnumber = 28Maximum blur radius in dp for blur mode. Clamped to zero or greater.
number = 28Maximum blur radius in dp for blur mode. Clamped to zero or greater.
frostProgressionnumber = 1Fraction of the edge band over which blur reaches full strength. Clamped from 0.05 to 1.
number = 1Fraction of the edge band over which blur reaches full strength. Clamped from 0.05 to 1.
radiusnumberCorner radius shared by the fade and clipping. Use this instead of style.borderRadius.
numberCorner radius shared by the fade and clipping. Use this instead of style.borderRadius.
styleStyleProp<ViewStyle>Container layout and styling; borderRadius is ignored with a development warning.
StyleProp<ViewStyle>Container layout and styling; borderRadius is ignored with a development warning.
EdgeConfigTypeDescription
sizenumberOverride the component fade depth for this edge.
numberOverride the component fade depth for this edge.
curveEdgeFadeCurveOverride the component curve for this edge.
EdgeFadeCurveOverride the component curve for this edge.
colorColorValueOverride the overlay color for this edge. Ignored in blur and mask modes.
ColorValueOverride the overlay color for this edge. Ignored in blur and mask modes.

An EdgeFadeCurve is a preset name, a cubic bezier { type: 'cubicBezier', x1, y1, x2, y2 }, or an alpha-stop list { type: 'stops', values: [1, 0.4, 0] }. Stops run from the inner edge to the outer edge and require at least two values between 0 and 1. The native iOS blur mode blends three masked material layers. It does not expose Apple’s private variable-radius filter.

Curve helpers

One.UI.sampleCurve(curve) returns inner-to-outer alpha values. Presets and cubic beziers produce 32 samples, rounded to four decimal places. A stop list retains its length and clamps each value to 0–1.

One.UI.serializeCurve(curve) returns the preset name for a preset, or the sampled alpha values joined with commas for a bezier or stop list. EdgeFade serializes its own curve; use these helpers when inspecting a curve or passing it to another effect.

import { One } from 'one'
const alphas = One.UI.sampleCurve('linear')
// 32 samples, beginning at 1 and ending at 0
const encoded = One.UI.serializeCurve({ type: 'stops', values: [1, 0.4, 0] })
// "1,0.4,0"
CubicBezierCurveTypeDescription
type (required)"cubicBezier"Select the cubic bezier curve.
"cubicBezier"Select the cubic bezier curve.
x1 (required)numberFirst control point x coordinate.
numberFirst control point x coordinate.
y1 (required)numberFirst control point y coordinate.
numberFirst control point y coordinate.
x2 (required)numberSecond control point x coordinate.
numberSecond control point x coordinate.
y2 (required)numberSecond control point y coordinate.
numberSecond control point y coordinate.
StopsCurveTypeDescription
type (required)"stops"Select an alpha-stop list.
"stops"Select an alpha-stop list.
values (required)[number, number, ...number[]]At least two alpha values, ordered from the inner edge to the outer edge.
[number, number, ...number[]]At least two alpha values, ordered from the inner edge to the outer edge.

Mask props

Mask also accepts React Native ViewProps. Size both the container and the mask element so the mask covers the content bounds.

PropsTypeDescription
maskElementReactNodeThe offscreen mask element. Opaque pixels show children; transparent pixels hide them.
ReactNodeThe offscreen mask element. Opaque pixels show children; transparent pixels hide them.
styleStyleProp<ViewStyle>Container layout and styling.
StyleProp<ViewStyle>Container layout and styling.

Edit this page on GitHub.