CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever 1.0.327.498

There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever --version 1.0.327.498
                    
NuGet\Install-Package CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever -Version 1.0.327.498
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever" Version="1.0.327.498" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever" Version="1.0.327.498" />
                    
Directory.Packages.props
<PackageReference Include="CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever --version 1.0.327.498
                    
#r "nuget: CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever, 1.0.327.498"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever@1.0.327.498
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever&version=1.0.327.498
                    
Install as a Cake Addin
#tool nuget:?package=CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever&version=1.0.327.498
                    
Install as a Cake Tool

CodeBrix.WebPlatform.WebGpu

WebGPU for the browser frontends of CodeBrix.WebPlatform applications: packages that bring the Rust crates for showing 3D graphics, scenes and animations in the browser window to an application's Rust frontend, as crate bundles that the application's build program registers - so that the frontend still builds offline, with nothing to download. The frontend uses WebGPU only, with no WebGL fallback, and low-level access to the wgpu API always stays available beside anything built on it. CodeBrix.WebPlatform.WebGpu is provided as .NET 10 libraries and the associated CodeBrix.WebPlatform.WebGpu.ApacheLicenseForever, CodeBrix.WebPlatform.WebGpu.Graphics.ApacheLicenseForever and CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever NuGet packages.

CodeBrix.WebPlatform.WebGpu supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.

Installation

dotnet add package CodeBrix.WebPlatform.WebGpu.ApacheLicenseForever

(Add it to the application's BUILD PROGRAM - the program that references CodeBrix.WebPlatform.FrontendBuilder and materializes the frontend.)

Note that the NuGet package IDs and the namespaces are different - there are no packages named plain CodeBrix.WebPlatform.WebGpu, CodeBrix.WebPlatform.WebGpu.Graphics or CodeBrix.WebPlatform.WebGpu.Animation:

  • NuGet package ID: CodeBrix.WebPlatform.WebGpu.ApacheLicenseForever - assembly and primary namespace CodeBrix.WebPlatform.WebGpu
  • NuGet package ID: CodeBrix.WebPlatform.WebGpu.Graphics.ApacheLicenseForever - assembly and primary namespace CodeBrix.WebPlatform.WebGpu.Graphics
  • NuGet package ID: CodeBrix.WebPlatform.WebGpu.Animation.ApacheLicenseForever - assembly and primary namespace CodeBrix.WebPlatform.WebGpu.Animation

XML documentation (IntelliSense) ships alongside each assembly.

Every package depends on CodeBrix.WebPlatform.Core, at exactly the platform version its crates were chosen against; the Graphics and Animation packages also depend on exactly the same version of the CodeBrix.WebPlatform.WebGpu package (the three are built and published together), and never on each other. Use these packages with the CodeBrix.WebPlatform packages of that same version.

CodeBrix.WebPlatform.WebGpu supports:

  • The Rust wgpu crates for WebGPU in the browser and the glam maths crate, and every crate they need, carried by the CodeBrix.WebPlatform.WebGpu package exactly as crates.io published them, as one archive
  • The crate codebrix-webgpu, carried in the same archive: the WebGPU context that owns or shares the device, one canvas host component with its frame loop and input, layers of independent renderers on one canvas with one clock (pause, resume, speed, named points in time), a transparent canvas for drawing "on the page" (the page shows through where nothing is drawn, with correct blending at translucent parts and edges), the "WebGPU is not available" result and message, and the maths types - all without JavaScript
  • One registration call in the build program that hands those crates to the platform's frontend build as a crate bundle, so that they are written into the frontend beside the platform's own crates and the frontend builds offline
  • Crates shared with the platform kept at the platform's exact versions and content, so that the platform's strict rule for crate bundles is met
  • The generated third-party notices for those crates, handed to the build program to serve with the site
  • WebGPU only, with no WebGL fallback: a frontend shows its own "WebGPU is not available" message when the browser gives it no adapter
  • One uncaptured-error handler per device, installed by codebrix-webgpu, with any number of readers that each see every error - so that several libraries can share one device
  • CodeBrix.WebPlatform.WebGpu.Graphics and its crate codebrix-webgpu-graphics: the graphics context, buffers, textures, samplers, shaders, bind groups, the render pipeline builder, frames and render passes of the .NET library CodeBrix.WebGpu.Graphics, with the same type names and argument order, drawing as a layer of the canvas host; the library's built-in WGSL shaders, compiled by the browser; device creation, readback and shader diagnostics as async calls, and WebGPU's validation errors as a queue
  • 2D sprites and shapes with the SpriteBatch (texture atlases, tint, rotation, scale and origin, a transform stack, rectangles, lines, triangles and circles, one draw call per texture run)
  • Lit 3D meshes: the built-in cube, box, plane and sphere, the MeshRenderer with lit materials, depth, instancing and translucency, perspective and orthographic cameras, and an orbit controller driven by the canvas's input (drag to orbit, the wheel to zoom, one-finger orbit and pinch zoom on touch screens, auto-orbit until the first drag)
  • glTF models with physically based shading: a binary model-data format owned by the Graphics package - a .NET writer for model data made from glTF files in .NET (meshes, materials, decoded textures, nodes, skins, morph targets and animations), and the crate's reader, which uploads the data to the GPU unchanged - with Model, ModelInstance and the ModelRenderer (instanced draws, every glTF metallic-roughness material input, alpha modes, mirroring, up to eight directional lights, image-based or hemispheric ambient light); the crate takes the bytes from anywhere and never fetches them itself
  • Animation playback, skinning and morph targets: each model instance's AnimationPlayer plays the model's clips (step, linear and cubic-spline keys; loop, ping-pong and once; speed, seeking, cross-fades and weighted, layered blending), driven by the frame's time from the canvas host's clock, and the ModelRenderer skins and morphs the posed instances on the GPU
  • Image-based lighting, a skybox and tone mapping: environments baked on the GPU from a procedural sky or from a high-dynamic-range panorama (given as linear pixels, or as the bytes of a Radiance .hdr file, which the crate decodes), the BRDF lookup table, the SkyboxRenderer, an HDR render path through an offscreen RGBA16Float target, and the ToneMapper with ACES (fitted and Narkowicz), Khronos PBR Neutral, Reinhard and clamping, with an exposure and an option that keeps the scene's alpha, so models can be drawn over the page with HDR on
  • Animated textures (frames with durations, looping, ping-pong or once, as a texture array or streamed through a ring of layers, drawn by the SpriteBatch), render bundles recorded once and replayed every frame, indirect draws and dispatches, compute pipelines and passes, GPU time per pass from timestamp queries where the browser grants them, buffer mapping, texture regions and copies, and the asynchronous readback of textures and offscreen targets
  • One list in the AGENT-README of what the .NET library has and a browser cannot do, with what to use instead
  • CodeBrix.WebPlatform.WebGpu.Animation and its crate codebrix-webgpu-animation: real-time 2D animation with the names and concepts of the .NET library CodeBrix.Imaging.Drawing.NoSkia - a drawing session of calibrated units with layers of shapes (rectangles with rounded corners, circles, ellipses, lines, polylines and polygons, paths parsed from SVG path data or built, filled with colours or linear and radial gradient fills and stroked with caps, joins, miter limits and dashes), single lines of text in fonts the application supplies as bytes (shaped with kerning and ligatures, aligned, tracked and measured, never a system font, with a choice of what a character the font lacks shows and a report of it), whole-session and layer fades, the debug overlay, the animation model (keyframe tracks with per-segment easing, holds and loops, bound to the properties of elements, layers and a camera with parallax; transforms, groups, time windows, shapes rebuilt for each moment, and layout against the frame or a safe rectangle), paths that are drawn on by their trims, followed by moving elements and morphed into one another, pictures and sprite sheets from decoded pixels the application supplies or from PNG files the library decodes itself (stretched into place, tinted, sampled smoothly or as hard pixels, a sprite's frame chosen by the time), masks (inside or outside a path, or a matte from another layer) and blur, glow and drop-shadow effects on elements, groups and layers that follow their scale and the camera, with every effect parameter bindable to a track, blocks of text wrapped, aligned and trimmed by the library's own line breaker in styled runs, revealed character by character, word by word or line by line, split into pieces that are staggered or sent rolling along a path, captions from SRT and WebVTT text placed against the frame (or, on request, inside a safe-area guide), path combining (union, intersection, difference, exclusive-or, overlap removal, stroke outlines, inflating and deflating) and path queries (inside, distance to the edge, nearest point, the gap between two areas), bindings that add to or multiply what other bindings set, elements rolling and travelling as trains along paths, formations of many elements filling a shape and arriving over time, layers switched on and off by tracks, and safe-area guides of video platforms with a preview overlay and a check of what reaches into their unsafe zones, SVG documents drawn as elements (shapes, paths, gradients, clips, masks, blend modes, a blur, text in fonts the application supplies, and pictures it supplies as pixels or PNG files) whose parts are moved, turned, faded and trimmed by id and bound to tracks, and which play their own SMIL and CSS keyframe animations, every easing curve of the .NET library with steps and cubic-bezier curves, colour ramps, timelines with cues and markers, pixel planes with the .NET library's filters, blends, transitions, noise, particles and motion blur computed with its exact values, and their real-time counterparts drawn on the GPU (tone curve, gamma, vignette and bloom over a layer, transitions between layers, noise computed per pixel, particles in one instanced draw), animated brush strokes that paint themselves on, ownership maps with colour pickup and seams coloured on the GPU, hard-edged masks and keyframe players for painterly playback, and the playback controller - all driven by the frame's time from the canvas host's clock, never by a clock of their own
  • The crate's own GPU renderer for 2D vector content, built on the kurbo curve crate and the peniko brush types, with text shaped by the harfrust crate, paths combined by the i_overlay crate on an integer grid, PNG files read by the png crate and SVG documents read by the usvg crate (all carried by the Animation package exactly as crates.io published them): non-zero and even-odd fills, strokes, solid colours and linear, two-point radial and sweep gradients with pad, repeat and reflect, every blend and compose mode, nested clips, groups with opacity and blend, images, noise and ownership maps computed per pixel, instanced particles, and the offscreen passes of masks, effects, whole-frame operations and transitions (separable Gaussian blurs, computed at a coarser resolution when they are wide); it draws as a layer of the canvas host over whatever the layers below drew, for example a 3D scene of the Graphics package, and caches outlines and batches draws between frames
  • Lottie animations: Lottie JSON read through the velato crate (carried by the Animation package exactly as crates.io published it), played at the session's time as an element of a drawing session - loop, ping-pong or hold, speed, a range of frames or a marker, markers as named points in time on the clock, image layers drawn from pictures the application supplies as pixels or PNG files - and drawn by the crate's own renderer, with a report of what a file uses that is not drawn as written; the crate's own pass over the JSON guards the reader against content it cannot handle
  • An application may use Graphics or Animation, or both: only the application puts their renderers together, on one canvas with one clock

Sample Code

Register the WebGpu crates in the build program

using CodeBrix.WebPlatform.FrontendBuilder;
using CodeBrix.WebPlatform.WebGpu;

WebGpuCrates.Register();

var frontend = new PlatformFrontend(new PlatformFrontendOptions
{
    FrontendDirectory = "frontend",
    BackendProjectPath = "backend/MyApp.Api/MyApp.Api.csproj",
});
await frontend.MaterializeAsync();

The frontend then names codebrix-webgpu in its own Cargo.toml and draws with it:

use codebrix_webgpu::{CanvasClock, CanvasLayers, GpuContext, RendererHandle, WebGpuCanvas, WebGpuUnavailable};
use dioxus::prelude::*;

#[component]
fn Page() -> Element {
    let gpu = use_resource(GpuContext::request);
    let clock = use_hook(CanvasClock::new);
    let layers = use_hook(|| CanvasLayers::new(vec![RendererHandle::new(Scene::new()), RendererHandle::new(Titles::new())]));
    let state = gpu.read();
    match &*state {
        None => rsx! { p { "Asking the browser for a WebGPU adapter..." } },
        Some(Err(reason)) => rsx! { WebGpuUnavailable { reason: reason.clone() } },
        Some(Ok(context)) => rsx! { WebGpuCanvas { context: context.clone(), layers, clock, class: "w-full aspect-video" } },
    }
}

(Scene and Titles are the application's renderers: each implements CanvasRenderer and draws with the wgpu device directly.)

Leave WebGPU content out where the browser has no WebGPU

WebGpuBoundary makes its children only where WebGPU works. Elsewhere it shows its fallback, or nothing at all when it has none, so the visitor never sees a "not available" message. The children read the context with use_gpu(), and every boundary of a page shares one request to the browser. A page that needs more of the device (a power preference, features, limits) says so once with set_page_gpu_options:

use codebrix_webgpu::{use_gpu, CanvasClock, CanvasLayers, RendererHandle, WebGpuBoundary, WebGpuCanvas};
use dioxus::prelude::*;

#[component]
fn Page() -> Element {
    rsx! {
        h1 { "Welcome" }
        // An optional animation: where WebGPU is not available, it is simply not there.
        WebGpuBoundary { HeroAnimation {} }
        // A picture in its place instead.
        WebGpuBoundary {
            fallback: |_| rsx! { img { src: "/hero-still.webp" } },
            HeroAnimation {}
        }
    }
}

#[component]
fn HeroAnimation() -> Element {
    let gpu = use_gpu();
    let clock = use_hook(CanvasClock::new);
    let layers = use_hook(|| CanvasLayers::single(RendererHandle::new(Scene::new())));
    rsx! { WebGpuCanvas { context: gpu, layers, clock, class: "w-full aspect-video" } }
}

Animate 2D shapes on the canvas

The build program registers the Animation package (AnimationCrates.Register();, which registers the WebGpu package's crates first), and the frontend names codebrix-webgpu-animation in its Cargo.toml:

use std::cell::RefCell;
use std::rc::Rc;
use codebrix_webgpu::{CanvasLayers, RendererHandle};
use codebrix_webgpu_animation::animation::{ColorRamp, Easing};
use codebrix_webgpu_animation::rendering::AnimationLayer;
use codebrix_webgpu_animation::shapes::{CircleShape, ShapeOptions};
use codebrix_webgpu_animation::{Color, DrawingSession, DrawingSessionOptions};

let mut session = DrawingSession::new(DrawingSessionOptions { calibration_size: (1280, 720), layer_opacity: 255, ..Default::default() });
session.add_layer("Dots", Color::from_rgb(255, 176, 72))
    .add_shape(CircleShape::new(640.0, 360.0, 40.0, ShapeOptions { is_filled: true, ..Default::default() })?);
let ramp = ColorRamp::from_colors(&[Color::from_rgb(214, 96, 120), Color::from_rgb(120, 90, 210)])?;
let session = Rc::new(RefCell::new(session));
let layer = AnimationLayer::new(move |frame, scene| {
    let mut s = session.borrow_mut();
    if let Some(dots) = s.get_layer_mut("Dots") {
        dots.set_color(ramp.at(Easing::sine_in_out((frame.info.time / 4.0).fract())));
    }
    s.set_time(frame.info.time);   // the frame's time from the host's one clock
    s.render(scene, frame.info.width, frame.info.height);
});
let layers = CanvasLayers::new(vec![RendererHandle::new(layer)]);

Documentation

The NuGet packages include AGENT-README.txt, a complete API reference and usage guide written for AI coding agents - point your agent at that file when it is writing code against these libraries.

Additional sample code and usage examples are available in the test projects: https://github.com/ellisnet/CodeBrix.WebPlatform.WebGpu/tree/main/tests

License

CodeBrix.WebPlatform.WebGpu is licensed under the Apache License 2.0 - see the LICENSE file.

For licensing and provenance information about the open source code included in this package, see THIRD-PARTY-NOTICES.txt.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.329.593 0 11/25/2026
1.0.327.498 57 11/23/2026