Repository navigation
Conversation
Replicates Telegram iOS InvisibleInkDustNode physics/visuals behind ParticlePreset.telegramDust: ballistic drift at ~0.35 specks/px², 1s life alpha pulse, grainy speckle sprite, tap simpleAttractor spring, and an expanding radial spotlight that reveals tap-first with a soft edge across all four render backends (atlas, vector, vertices, shader).
Showcases the telegramDust preset on a text spoiler and a widget spoiler with a backend selector (atlas/mesh/vector/shader) so all four render paths can be compared interactively.
…low drift Re-reading InvisibleInkDustNode revealed three wrong assumptions: - valueOverLife uses additive=true on base alpha 1.0: specks are born bright, hold brightness for 75% of life, and fade out in the final quarter — they do not blink in and out. - velocityRange=20 with base velocity 0 yields speeds of 0-10pt/s, half the previous drift. - Effective visible density in the media-spoiler reference is far below the text birthRate: default dustDensity drops 0.35 -> 0.05, matching the measured 0.0235 bright specks/pt2 in the reference recording.
Numerical crop comparison against the Telegram reference (same device, same scale) showed specks reading at half the reference size: the speckle texture's solid core was only 45% of the quad and the alphaRange jitter bottomed at 0.55. Solid core is now 62% with a short feather, nominal size is 1.6pt, and jitter floor is 0.7 — bright-blob median now measures 9px2 against the reference's 8px2 (was 4px2).
Bright-pixel coverage measured 14.9% against the reference's 2.2% on the shader backend. Two causes: the disc was solid out to the full speck radius (bright area ~19px2 vs the CPU backends' ~9px2, and kEmitterBoost still assumed the old blinking alpha model — with persistent brightness ~90% of specks are visible, so emission density must run below nominal. Disc is now a 62%-core feathered profile matching the speckle texture, boost is 0.55. Coverage now measures 2.7% versus the reference's 2.2%. EOF )
The wave-exclusion guard pre-dated the 1s dust lifetime: wave displacements now self-heal within one life cycle as specks respawn, so the ambient ripple system is compatible with ballistic dust (CPU backends). The demos text spoiler uses dustDensity 0.3 - Telegram emits text dust at 0.35/px2 of word-rect area, producing dense glyph-hugging noise, while media spoilers stay sparse at 0.05.
Ripples are (center, age) state evaluated statelessly by every backend — ring expands at 320pt/s for 1.4s. CPU backends apply a radial velocity kick in moveBallistic plus a small brightness flash; the shader uses small positional displacement only. The flash/swell variants were dropped on shader: amplifying every speck in the band at once blends overlaps into a continuous white band, destroying the dust texture. Ambient ripples fire per-controller with staggered random countdowns so multiple spoilers never synchronize.
Up to 3 ripples now run concurrently — the shader gets one vec4 uniform slot per ripple plus static speed/width/strength uniforms, while CPU backends iterate the list in moveBallistic and the visual flash. New ParticleConfig knobs: dustRippleSpeed, dustRippleWidth, dustRippleStrength, dustRippleInterval (0 disables ambient ripples; tap ripples always fire). Also reverts example/macos build artifacts that leaked into the branch.
- Rename ParticlePreset.telegramDust/ParticleConfig.telegramDust() to dust/dust() and scrub reference mentions from code comments - Raise CPU-backend spawn density 0.05 -> 0.07 per pt2 (media surfaces read too sparse on atlas/mesh/vector); compensate shader emission boost 0.55 -> 0.4 so the shader keeps its approved density - Correct shader text dilution: emission is uniform across the spoiler bounds, but CPU backends spawn inside glyph word-rects. Scale the density uniform by inverse path coverage (clamped 0.15..1) so text matches the CPU backends instead of diluting into whitespace
The edge treatment scaled speck radius by distance to the spoiler bounds. Thin regions like single-line text are all-edge: every speck shrank to a pinprick, making shader text read far sparser than the CPU backends even at equal density. - speck radius is now constant regardless of edge proximity - edge fade is alpha-only, and its span caps at a quarter of the smallest dimension so thin regions keep most of their area bright
Every speck used to fade along the same uniform curtain line, reading as a hard edge. Now each speck gets a jittered zero line and fade width: high-jitter specks survive almost to the boundary while low-jitter ones dissolve deeper inside, so the edge reads as a soft organic falloff. Zero lines stay inside the rect so the hard clip never cuts mid-fade.
Pure random placement clusters: adjacent specks merge into lumps, most visible on large media surfaces (p90 blob measured ~39px2 vs ~12px2 reference). The spawn pool is now one jittered sample per grid cell, shuffled and consumed in order so spawns do not re-cluster positions.
Drop the legacy random-walk particle system entirely: the ballistic speck model is now the only particle behavior. - ParticleConfig rewritten: density (specks/pt2), maxDriftSpeed, lifetime, ripple* — no preset enum, no legacy speed/shape/waves - ParticlePreset, wave system, SpoilerSpotsController, mergeLegacyParticleConfig and all deprecated scalar shims deleted - legacy particles.frag/particles_nosprite.frag content replaced by the dust shaders (renamed); ShaderConfig.dust() folded into ShaderConfig.particles() - ripples, attractor and spotlight reveal are now unconditional - text config defaults to dense glyph-hugging particles (0.3, white70)
- controller tests: speckle debug hook, fadeConfig: null for instant-toggle cases - configs/utils/dust tests rewritten for the unified config - 102/108 passing; remaining 6 text_field_wrapper failures are two-pass reveal paint crashes in the test harness under investigation
- isRevealed no longer gates on particle presence: on the first enable the drawer is still empty when the cover sweep starts, so masked spans went transparent instantly and stayed hidden through the whole sweep — text vanished before the cover circle reached it. Transitions and the revealed state now control visibility directly. - SpoilerController defaults to enabled (fail closed) so a seeded mask still can't flash secret text before the first initializeParticles. - Rewrote _paintChildWithRevealSpot with compositing primitives (pushClipPath + ShaderMaskLayer): the child paint pushes its own filter layer, which finalizes and replaces the context canvas — the cached canvas's restore hit a dead native peer (crashed in tests) and canvas clips never propagated into the pushed layers at all. - Test migration: logic tests opt out of the default fade again (fadeConfig: null — the pre-refactor enableFadeAnimation: false semantics), fade tests pump past the full 550ms sweep.
- A tap consumed by spoiler toggle also reaches the field, whose tap-on-focused-field behavior pops the selection toolbar (Select All on a collapsed selection). The wrapper interposes every toolbar build via contextMenuBuilder, so the menu is suppressed for 500ms after a consumed tap — reveal toggles no longer surface editing UI. - Position-dependent reveal duration floored at 220ms instead of 80ms: off-center taps on tall regions compressed the whole sweep into ~5 frames, reading as an instant disappearance even when correct.
pushClipPath shifts both the bounds rect and the clip path by the offset internally (framework contract — RenderClipPath passes Offset.zero & size). Passing paintBounds.shift(offset) double-shifted the bounds; in non-compositing paints the bounds becomes a real clip rect, so content at large offsets (text fields deep in a scrolled page) was culled entirely — rendering black outside the spoiler rect.
Ballistic drift and ripple velocity injections are unconfined, so specks free-streamed out of the spoiler region — on the overlay pipeline, which has no particle clip, they rendered across the whole screen. Emitter semantics self-heal: a speck leaving its region dies and respawns inside it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opt-in
ParticlePreset.telegramDustreplicating Telegram iOSInvisibleInkDustNodephysics and visuals across all four render backends (atlas, vector, vertices, shader):[0,0,1,0,-1]— no diffusive random walkSpeckleImageFactorygrainy noise texture (atlas + shaderuParticleTex),ParticlePathPreset.specklefor vector, jittered ring for verticesParticleAttractorspring (stiffness 4, radius = maxDim, mass-scaled) plumbed throughupdate(dt); expanding spotlight reveals tap-first with a soft radial-gradient edge via two-pass child paint inRenderSpoilerspotRadius = fadeMaxRadius − fade.radiusgrows from the tap during the reverse sweep; position-dependent duration (~550ms base, ×2 tall aspect);FadeConfig.durationoverride; waves suppressed for dustdust.frag/dust_nosprite.frag— stateless hashed grid, ballistic drift confined to the ±1-cell window via triangle fold, life pulse, spot feather matching mask stops[0, 0.7, 0.95, 1.0],uAttractorvec4 patched per-frame byShaderSpoilerDrawer(positional pull approximation — a stateless shader cannot integrate spring velocity)ParticleConfig.telegramDust()factory +dustDensity/dustMaxSpeed/dustLifetimefields;density/speed/shapePreset/enableWavesignored under dust; all signature changes are package-private (non-breaking)Test plan
flutter analyze— clean (only pre-existingdeprecated_member_useinfos)flutter test— 112 tests pass, including 8 new dust tests (ballistic determinism, attractor spring, spawn count, spotlight reveal) and dust cases inshader_uniforms_testBase:
release/1.1.2— this branch is exactly one commit ahead of it; targetingmainwould pull in the three unreleased 1.1.2 commits.