GlassVariantConstants class
Per-variant rendering constants (lengths in logical px).
- Annotations
Constructors
-
GlassVariantConstants({required double blurSigma, double blurSizeRef = 0, double frostWideSigma = 0, double frostWideMixEdge = 0, double frostWideMixCentre = 0, double frostWideSizeRef = 0, double frostWideSizeDrop = 0, List<
double> toneKnots = identityToneKnots, List<double> smallToneKnots = identityToneKnots, double smallSizeLo = 0, double smallSizeHi = 0, double postJacobianMax = 4, double ambientMix = 0, double ambientReach = 0, double shadowOffsetY = 0, double dispersionTangent = 0, double lensEllipse = 0, double backdropInset = 0, double ambientLift = 0, double backdropReach = 0, double bandSplitDrop = 0, double toneLumaMix = 0, double glowStrength = 0.25, double normalRadiusScale = 1, double lensEdge = 0, double lensEdgeDecay = 0.6, double rimMix = 0, double rimMixWidth = 1.5, double rimMixCut = 1, double rimMixLumaFloor = 1, double toneLift = 0, double blurAspectPower = 0, double rimBack = 0.35, double lensVertical = 0, double rimTint = 0, double rimHue = 0, double toneLiftKnee = 0.5, double toneLiftSizeRef = 0, required double lensBand, required double lensStrength, required double lensDecay, required double lensSizeRef, required double dispersion, required double rimWidth, required double rimIntensity, required Color fillColor, required double fillOpacity, double fillSizeRef = 0, double fillSizeDrop = 0, required double saturation, required double dim, required double shadowRadius, required double shadowOpacity, required double tintStrength}) -
Creates variant constants.
const
-
GlassVariantConstants.fromJson(Map<
String, Object?> j, GlassVariantConstants base) -
Reads keys present in
j; missing keys come frombase.factory
Properties
- ambientLift → double
-
How much the whole glass lightens with the average luma of the
backdrop under it beyond 0.2 (less where the backdrop behind a pixel
is already light). iOS 26.4's tab bar does: over bright content its
dark glass lightens as a whole. 0 = off.
final
- ambientMix → double
-
Strength of the ambient colour (item 8): the glass adds this times the
chroma (colour minus its luma) of the blurred backdrop's average over
the shape, as SwiftUI's large regular glass carries the backdrop's
average hue. Off in the small-shape class; 0 = off.
final
- ambientReach → double
-
How far (pt) the ambient colour's average reaches beyond the shape's
rect on each side (item 8).
final
- backdropInset → double
-
When > 0, the glass refracts only the backdrop between its top and
bottom inset by this much (logical px); what it would bend in from
beyond reads black. iOS 26.4's tab lens overhangs the bar by this
much and bends in only the bar, so its bands above and below stay
dark over any page. 0 = the whole backdrop.
final
- backdropReach → double
-
How far (logical px) beyond the band backdropInset leaves the glass
still refracts: iOS 26.4's tab lens shows the bar's edge, its shadow
and the page right by it (their fringes are its rainbow in light
mode), never the page further out.
final
- bandSplitDrop → double
-
How much of the colour split across the rim is dropped where the
glass reaches past backdropInset's band: 1 keeps only the split
along the rim there. iOS 26.4's dark tab lens shows its overhang
near black (the split tinted it blue with the bar); its light lens
keeps the rainbow (0).
final
- blurAspectPower → double
-
Anisotropic frost (Task 17d, fitted from SwiftUI's directional detail
on dark regular capsules: a wide shape keeps more detail along its long
axis): sigmaX = σ·(h/w)^power, sigmaY = σ·(w/h)^power. 0 = isotropic.
final
- blurSigma → double
-
Gaussian sigma of the frost blur (logical px).
final
- blurSizeRef → double
-
Shapes whose half shorter side is below this get a proportionally
smaller frost blur: σ = blurSigma × min(1, halfMin / blurSizeRef).
0 disables the scaling.
final
- dim → double
-
Darkening applied after the fill (used by
clear).final - dispersion → double
-
Red/blue split as a fraction of the lens displacement, weighted by the
lens profile (so it sits on the outer pixels). SwiftUI shows none.
Negative splits red from green and blue together (iOS's tab lens),
so a blue tint fringes in shades of blue rather than green.
final
- dispersionTangent → double
-
A sideways colour split along the outline, as a share of the lens's
displacement: red and blue taps move in opposite directions along the
rim, so a band's fringe is warm at one end and cool at the other (iOS
26.4's tab lens). 0 splits only along the normal (dispersion).
final
- fillColor → Color
-
Colour the content behind the glass is washed toward (opaque; JSON
"#RRGGBB"or an int ARGB).final - fillOpacity → double
-
How far the content is mixed toward fillColor (0 = untouched).
final
- fillSizeDrop → double
-
Fraction of fillOpacity lost on a vanishingly small shape (see
fillSizeRef).
final
- fillSizeRef → double
-
Shapes whose half shorter side is below this get a weaker fill:
fillOpacity × (1 − fillSizeDrop × (1 − min(1, halfMin /
fillSizeRef))). 0 disables it.
final
- frostWideMixCentre → double
-
Wide-tail weight where the lens samples at the shape's centre line
(sample depth = half the shorter side); see frostWideMixEdge.
final
- frostWideMixEdge → double
-
Wide-tail weight where the lens samples at the outline; with
frostWideMixCentre it gives
w = mix(edge, centre, sampleDepth / halfMin), minus the size term of frostWideSizeRef, clamped to 0..1.sampleDepthis the depth of the point the lens samples, so the band (which mirrors the interior) gets the interior's weight.final - frostWideSigma → double
-
Sigma of the wide frost tail added in the shader on top of the
blurSigma core (logical px; 0 disables the tail).
final
- frostWideSizeDrop → double
-
Wide-tail weight lost per unit of
1 − halfMin /frostWideSizeRef.final - frostWideSizeRef → double
-
Shapes whose half shorter side is below this lose wide-tail weight:
w −=frostWideSizeDrop× (1 − halfMin / frostWideSizeRef). 0 disables the size term.final - glowStrength → double
-
Brightness of the touch glow at full press (Task 17d; 0.25 is the
pre-17d behaviour, left for the motion fit).
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- lensBand → double
-
Depth inside the outline where the edge lens ends (displacement 0).
final
- lensDecay → double
-
Exponential falloff length of the lens displacement.
final
- lensEdge → double
-
Extra inward lens offset at the outline (logical px), falling off as
exp(−depth / lensEdgeDecay)(Task 17d, measured: SwiftUI's lens is steeper in the outer 1–2 pt). 0 disables it.final - lensEdgeDecay → double
-
Falloff length of lensEdge (logical px).
final
- lensEllipse → double
-
How far (0-1) the lens bends along the normals of the ellipse
inscribed in the shape instead of the outline's: along a capsule's
flat sides the bend turns gradually towards the round ends (iOS 26.4's
tab lens: its bands thin smoothly towards the ends). 0 = the outline.
final
- lensSizeRef → double
-
Shapes whose half shorter side is below this get a uniformly scaled-down
lens (band, decay and displacement × that ratio); 0 disables it.
final
- lensStrength → double
-
Edge displacement as a multiple of lensBand; negative samples inward
(SwiftUI: about -2.6, so the outer pixels show content from ~47 pt
inside, mirrored and compressed).
final
- lensVertical → double
-
How much the lens (main and edge terms) is limited to where the
outline faces up or down: 0 bends all round (the default); 1 leaves
the sideways-facing outline unbent, so a horizontal capsule's round
ends stay clear (iOS 26's tab lens, fitted to Kept).
final
- normalRadiusScale → double
-
Lens normals follow a rounder outline: each corner radius × this,
capped at half the shorter side (Task 17d, measured: 1.5–1.6 on
SwiftUI rects). 1 uses the outline itself; capsules and circles are
unaffected.
final
-
Share of the frost blur's variance applied after the lens instead of
before it (0..0.9; Task 17d, clear glass). The composed blur becomes
σ·√(1 − share) and the shader adds σ·√share in screen space, mapped
through the lens, so the refracted band is blurred like SwiftUI's.
final
- postJacobianMax → double
-
Largest stretch of the post-lens blur taps through the lens's Jacobian
(fidelity group 4: SwiftUI's clear-glass blur stays ~1.1-1.4 pt into the
outer 4 pt of the band). 4 is the original clamp.
final
- rimBack → double
-
Rim strength on the side facing away from the light, relative to the
lit side (0.35 = the pre-17d literal, shipped unfitted). Task 9
measured a fixed light with a directional mismatch — the device rim is
brightest around 135°, where the model's 315° light is weakest — so
this key exists for a bounded refit; it is not itself the measured
far/near ratio.
final
- rimHue → double
-
Hue of rimTint, in degrees.
final
- rimIntensity → double
-
Brightness added at the rim.
final
- rimMix → double
-
Isotropic rim: the outer pixels mix toward white by this alpha,
ramping to 0 at rimMixWidth and cut at rimMixCut (Task 17d,
measured on clear glass). 0 disables it.
final
- rimMixCut → double
-
Depth (logical px) where rimMix is cut off (a 1 px smoothstep).
final
- rimMixLumaFloor → double
-
rimMix is scaled by
floor + (1 − floor)·min(1, luma / 0.5)of the glass under it; 1 disables the scaling (dark mode measured 0.05).final - rimMixWidth → double
-
Depth (logical px) where the rimMix ramp reaches 0.
final
- rimTint → double
-
How far the isotropic rim (rimMix) turns from white towards
rimHue (0 = white, the default; iOS 26's tab lens has a teal rim).
Negative splits the rim's colour by side instead, by this much:
with rimHue 180, cooler where the outline faces left and warmer
where it faces right (iOS 26's dark tab lens); with 0, the reverse
(its light lens).
final
- rimWidth → double
-
Width of the specular rim.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- saturation → double
-
Saturation of the content behind the glass (1 = unchanged, 0 = grey).
final
- shadowOffsetY → double
-
How far (pt) the shadow (shadowRadius) is moved down; 0 centres it
on the shape.
final
- shadowOpacity → double
-
Shadow strength at the shape edge.
final
- shadowRadius → double
-
Shadow falloff radius outside the shape.
final
- smallSizeHi → double
-
Half shorter side (logical px) at and above which smallToneKnots is
off; the weight is linear in between. The feature is off when this is
<= 0 (Task g13).
final
- smallSizeLo → double
-
Half shorter side (logical px) at and below which smallToneKnots is
applied at full weight (Task g13).
final
-
smallToneKnots
→ List<
double> -
Grey tone LUT for small shapes: Task g13: measured on the reference
simulator — SwiftUI switches small shapes (half shorter side <= ~32 pt)
to a steeper tone response; this LUT is applied after the fill wash and
dim, weighted from 1 at smallSizeLo to 0 at smallSizeHi.
identityToneKnots disables it.
final
- tintStrength → double
-
How strongly
.tint()colours the glass.final -
toneKnots
→ List<
double> -
Grey tone curve applied to the frosted backdrop: piecewise linear
through these output knots at inputs
i / 8, after the saturation and before the fill wash (Task 17d, seeded from flat-grey captures and fitted). identityToneKnots disables it.final - toneLift → double
-
Small-shape shadow lift (Task 17d / 8b, fitted on dark regular glass):
after the tone LUT each channel gains
toneLift × size × max(0, 1 − c / toneLiftKnee)², withsize = max(0, 1 − halfMin / toneLiftSizeRef). SwiftUI lifts the dark end behind small dark glass (a capsule over a dark photo reads grey, not black). 0 disables it.final - toneLiftKnee → double
-
Input level where toneLift fades to 0.
final
- toneLiftSizeRef → double
-
Half shorter side (logical px) at and above which toneLift is 0;
0 disables the lift.
final
- toneLumaMix → double
-
How far the tone LUT is keyed on luma instead of applied per channel
(item 8 round 3): at 1 the LUT moves the frosted backdrop's luma and
its chroma rides along unchanged; 0 = per channel, as before.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object> -
JSON form; fillColor is written as
"#RRGGBB". -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
-
identityToneKnots
→ const List<
double> -
Grey tone LUT output knots at inputs
i / 8,i = 0..8(identityToneKnots reproduces the input exactly).