This example is running in WebGL2 and should work in most browsers. You can check the WebGPU examples here.
2d_top_down_camera.rs:
//! This example showcases a 2D top-down camera with smooth player tracking.
//!
//! ## Controls
//!
//! | Key Binding | Action |
//! |:---------------------|:--------------|
//! | `Z`(azerty), `W`(US) | Move forward |
//! | `S` | Move backward |
//! | `Q`(azerty), `A`(US) | Move left |
//! | `D` | Move right |
use BloomSettings;
use vec3;
use *;
use ;
/// Player movement speed factor.
const PLAYER_SPEED: f32 = 100.;
/// Camera lerp factor.
const CAM_LERP_FACTOR: f32 = 2.;
;
/// Update the camera position by tracking the player.
/// Update the player position with keyboard inputs.