{"id":15178470,"url":"https://github.com/totalkrill/bevy_ui_anchor","last_synced_at":"2025-10-26T17:30:52.536Z","repository":{"id":252134644,"uuid":"839527478","full_name":"TotalKrill/bevy_ui_anchor","owner":"TotalKrill","description":"Microlibrary for adding anchoring to UI","archived":false,"fork":false,"pushed_at":"2025-01-21T14:42:50.000Z","size":14418,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T21:34:52.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TotalKrill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-07T19:46:46.000Z","updated_at":"2025-01-21T14:42:53.000Z","dependencies_parsed_at":"2025-01-16T16:31:54.236Z","dependency_job_id":"4351c33f-fa46-489f-a26f-67a9c941e23c","html_url":"https://github.com/TotalKrill/bevy_ui_anchor","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":"0.19999999999999996","last_synced_commit":"2001ded457a6ec5a0293c22ef4acb8d8a88b8a27"},"previous_names":["totalkrill/bevy_ui_anchor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalKrill%2Fbevy_ui_anchor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalKrill%2Fbevy_ui_anchor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalKrill%2Fbevy_ui_anchor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalKrill%2Fbevy_ui_anchor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TotalKrill","download_url":"https://codeload.github.com/TotalKrill/bevy_ui_anchor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238375089,"owners_count":19461542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-27T15:03:38.333Z","updated_at":"2025-10-26T17:30:52.531Z","avatar_url":"https://github.com/TotalKrill.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy_ui_anchor\n\n[![crates.io](https://img.shields.io/crates/v/bevy_ui_anchor)](https://crates.io/crates/bevy_ui_anchor)\n[![docs.rs](https://docs.rs/bevy_ui_anchor/badge.svg)](https://docs.rs/bevy_ui_anchor)\n[![License](https://img.shields.io/crates/l/bevy_ui_anchor)](https://opensource.org/licenses/MIT)\n\nA Rust crate for anchoring UI elements to specific points or entities in the world using the Bevy game engine.\n\n![](follow.gif)\n\n## Features\n\nProvides an AnchorUiNode component that:\n\n- Anchor UI nodes to world positions or entities.\n- Supports horizontal and vertical anchoring.\n- Compatible with Bevy's ECS architecture.\n\n| Bevy version | Crate version |\n| ------------ | ------------------------ |\n| 0.17         | 0.10                     |\n| 0.16         | 0.6 - 0.9                |\n| 0.15         | 0.3 - 0.5                |\n| 0.14         | 0.1 - 0.2                |\n\n## Example\n\n``` rust\n//! Demonstrates how to work with Cubic curves.\nuse bevy::{\n    color::palettes::css::{ORANGE, SILVER, WHITE},\n    prelude::*,\n};\n\nuse bevy_ui_anchor::{AnchorPoint, AnchorUiConfig, AnchorUiPlugin, AnchoredUiNodes};\n\n#[derive(Component)]\n/// We need a marker for the camera, so the plugin knows which camera to perform position\n/// calculations towards\npub struct UiCameraMarker;\n\nfn main() {\n    App::new()\n        .add_plugins(DefaultPlugins)\n        // We need to define, which camera the anchorplugin will be anchored to\n        .add_plugins(AnchorUiPlugin::\u003cUiCameraMarker\u003e::new())\n        .add_systems(Startup, setup)\n        .run();\n}\n\nfn setup(\n    mut commands: Commands,\n    mut meshes: ResMut\u003cAssets\u003cMesh\u003e\u003e,\n    mut materials: ResMut\u003cAssets\u003cStandardMaterial\u003e\u003e,\n) {\n    // The camera\n    commands.spawn((\n        // mark it\n        UiCameraMarker,\n        IsDefaultUiCamera,\n        Camera3d::default(),\n        Transform::from_xyz(0., 6., 12.).looking_at(Vec3::new(0., 3., 0.), Vec3::Y),\n        DirectionalLight::default(),\n    ));\n\n    // Spawning a cube with anchored UI, using bevy relations\n    commands.spawn((\n        Mesh3d(meshes.add(Cuboid::new(0.3, 0.3, 0.3))),\n        MeshMaterial3d(materials.add(Color::from(ORANGE))),\n        Transform::from_translation([0.0, 0.5, 0.0].into()),\n        // Define the anchor relationship\n        AnchoredUiNodes::spawn_one((\n            AnchorUiConfig {\n                anchorpoint: AnchorPoint::bottomleft(),\n                offset: Some(Vec3::new(0.0, 0.5, 0.0)),\n                ..Default::default()\n            },\n            Node {\n                border: UiRect::all(Val::Px(2.)),\n                ..Default::default()\n            },\n            BorderColor::all(WHITE),\n            BorderRadius::all(Val::Px(2.)),\n            Outline::default(),\n            Children::spawn_one(\n                // text\n                Text(\"Text Anchored in bottom left\".into()),\n            ),\n        )),\n    ));\n\n    // ground plane\n    commands.spawn((\n        Mesh3d(meshes.add(Plane3d::default().mesh().size(50., 50.))),\n        MeshMaterial3d(materials.add(Color::from(SILVER))),\n    ));\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotalkrill%2Fbevy_ui_anchor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftotalkrill%2Fbevy_ui_anchor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotalkrill%2Fbevy_ui_anchor/lists"}