Blinc CSS Styling System - A Complete GPU-Accelerated CSS Engine for Rust #17
Pinned
darmie
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A complete, GPU-accelerated CSS engine for Rust — from selectors to 3D shapes to procedural shaders
Blinc now ships a full CSS styling engine that brings familiar web CSS syntax to native Rust UI, with capabilities that go well beyond what browsers offer. Every visual property, animation, and effect runs on the GPU through our SDF-based rendering pipeline.
Three Ways to Style
Blinc supports three composable styling approaches that work together seamlessly:
1. Global Stylesheets (Recommended)
2. Scoped Macros (
css!/style!)3. Builder API
All three compose together seamlessly — use stylesheets for shared design, macros for dynamic logic, and builders for one-off elements.
Full CSS Selector Support
The selector engine matches the CSS spec with full specificity calculation:
#id,.class,*:hover,:active,:focus,:disabled,:checked:first-child,:last-child,:nth-child(N),:only-child,:nth-of-type(N),:empty:not(),:is(),:where()::placeholder,::selection>), descendant (space), adjacent sibling (+), general sibling (~).card.highlighted:hover > .title:first-childAnimations & Transitions
CSS Transitions
Smooth property interpolation on any state change:
@Keyframes Animations
Multi-step animations with full keyframe control:
Animatable Properties
opacity, background (including gradient interpolation), border-color, border-width, corner-radius, corner-shape, box-shadow, text-shadow, transforms (rotate, scale, translate, skew), 3D transforms (rotate-x, rotate-y, translate-z), clip-path, mask-image, CSS filters, width, height, padding, margin, gap, overflow-fade, SVG fill/stroke/stroke-dashoffset/path
d— and more.FLIP Layout Animations
Automatic position animation when elements reorder or change layout. Any element with a CSS
transitionontransformwill smoothly animate to its new position after a layout change — no extra configuration needed:Filters & Backdrop Effects
CSS Filters
Supported:
blur,grayscale,sepia,invert,brightness,contrast,saturate,hue-rotateBackdrop Filters & Materials
Named materials for common effects:
Liquid Glass
Advanced refraction with bevel borders, as seen in the music player demo:
Clip Path & Masks
clip-path
Full spec support — circle, ellipse, inset, rect, xywh, polygon, and SVG path:
Clip paths are fully animatable:
mask-image
Gradient-based masks with luminance or alpha modes:
3D Shapes & Lighting
Native SDF-based 3D rendering — no meshes, no WebGL. Define 3D shapes in CSS and they're raymarched in the fragment shader with Blinn-Phong lighting:
Shapes: box, sphere, cylinder, torus, capsule
Boolean Operations for compound shapes:
Operations:
union,subtract,intersect,smooth-union,smooth-subtract,smooth-intersectUV-mapped backgrounds automatically wrap onto 3D surfaces — gradients, solid colors, all projected per-shape type.
@flow — GPU Procedural Shaders in CSS
Define custom GPU fragment shaders as composable DAG pipelines directly in your stylesheet. No WGSL, no shader files — semantic steps that compile to GPU code:
Semantic Steps
High-level operations that expand to GPU code automatically:
Available Step Types
pattern-noise(FBM),pattern-worley(cellular),pattern-ripple,pattern-waves,pattern-grid,pattern-gradient,pattern-plasmaeffect-refract,effect-frost,effect-specular,effect-fog,effect-lighttransform-wet,transform-warp,transform-rotate,transform-scale,transform-tile,transform-mirror,transform-polarcolor-ramp,color-shift,color-tint,color-invertcompose-blend,adjust-falloffFlows also compose via
use other_flow;and can be applied with CSS (flow: name), theflow!macro, or the builder (.flow("name")).Pointer Query System
CSS-driven continuous pointer interaction — no event handlers needed. Set
pointer-space: selfon any element and its CSS properties can react to the pointer in real time with exponential smoothing:Environment Variables
env(pointer-x),env(pointer-y)env(pointer-vx),env(pointer-vy)env(pointer-speed)env(pointer-distance)env(pointer-angle)env(pointer-inside)env(pointer-active)env(pointer-pressure)env(pointer-hover-duration)env(pointer-touch-count)Extended Math Functions
Functions:
min(),max(),clamp(),mix(),smoothstep(),step(),remap()SVG Animation
Animate SVG sub-elements with tag-name selectors — fill, stroke, dash effects, and path morphing:
Corner Shape & Overflow Fade
Superellipse Corners
Overflow Fade
Smooth alpha fading at overflow edges instead of hard clips:
Layout
Complete flexbox support styled through CSS:
Positioning:
absolute,relative,fixed,stickywithtop/right/bottom/left/inset.Theme System
Design tokens for consistent styling with light/dark mode support:
Tokens cover colors (primary, secondary, success, warning, error, surface, text, border), radii, and shadows.
Widget Styling
Built-in widgets respect the CSS cascade:
Additional form properties:
caret-color,scrollbar-color,scrollbar-width,accent-color.Mix Blend Modes
Example Demos
Run any demo with
cargo run -p blinc_app --example <name> --features windowed:styling_democss_features_demopointer_query_demomusic_playersvg_animation_demowet_glass_demoimage_css_demoflow_demosemantic_flow_demooverflow_fade_demosortable_demoWhat Makes This Different
Beta Was this translation helpful? Give feedback.
All reactions