{"id":15017995,"url":"https://github.com/corrosive-games/bevy-parallax","last_synced_at":"2025-05-16T07:04:24.597Z","repository":{"id":40549870,"uuid":"470790035","full_name":"Corrosive-Games/bevy-parallax","owner":"Corrosive-Games","description":"Parallax background plugin for Bevy","archived":false,"fork":false,"pushed_at":"2024-12-13T14:36:33.000Z","size":12876,"stargazers_count":114,"open_issues_count":5,"forks_count":19,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-08T16:08:37.140Z","etag":null,"topics":["bevy","bevy-engine","bevy-plugin","game-development","gamedev","parallax","parallax-scrolling","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Corrosive-Games.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-03-17T00:03:17.000Z","updated_at":"2025-02-19T05:55:28.000Z","dependencies_parsed_at":"2024-02-26T17:56:27.064Z","dependency_job_id":"ed5044a7-1909-4dbe-8612-fdd678998878","html_url":"https://github.com/Corrosive-Games/bevy-parallax","commit_stats":{"total_commits":69,"total_committers":11,"mean_commits":"6.2727272727272725","dds":0.6521739130434783,"last_synced_commit":"3978874fdcdb44763cb3f040647edb5b02685fd5"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corrosive-Games%2Fbevy-parallax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corrosive-Games%2Fbevy-parallax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corrosive-Games%2Fbevy-parallax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corrosive-Games%2Fbevy-parallax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Corrosive-Games","download_url":"https://codeload.github.com/Corrosive-Games/bevy-parallax/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485054,"owners_count":22078767,"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":["bevy","bevy-engine","bevy-plugin","game-development","gamedev","parallax","parallax-scrolling","rust","rust-lang"],"created_at":"2024-09-24T19:51:18.033Z","updated_at":"2025-05-16T07:04:24.572Z","avatar_url":"https://github.com/Corrosive-Games.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy-parallax\n\nA parallax plugin for the [Bevy Engine](https://bevyengine.org/). This plugin allows you to easily create scrolling\nparallax backgrounds for your games.\n\n![cyberpunk](assets/cyberpunk.gif)\n\n![fishy](assets/fishy.gif)\n\n## Usage\n\n```rust,no_run\nuse bevy::prelude::*;\nuse bevy_parallax::{\n    LayerSpeed, LayerData, ParallaxCameraComponent, ParallaxMoveEvent, ParallaxPlugin, ParallaxSystems, CreateParallaxEvent\n};\n\nfn main() {\n    let primary_window = Window {\n        title: \"Window Name\".to_string(),\n        resolution: (1280.0, 720.0).into(),\n        resizable: false,\n        ..default()\n    };\n    App::new()\n        .add_plugins(\n            DefaultPlugins\n                .set(WindowPlugin {\n                    primary_window: Some(primary_window),\n                    ..default()\n                })\n                // Use nearest filtering so our pixel art renders clear\n                .set(ImagePlugin::default_nearest()),\n        )\n        .add_plugins(ParallaxPlugin)\n        .add_systems(Startup, initialize_camera_system)\n        .add_systems(Update, move_camera_system.before(ParallaxSystems))\n        .run();\n}\n\npub fn initialize_camera_system(\n    mut commands: Commands,\n    mut create_parallax: EventWriter\u003cCreateParallaxEvent\u003e\n) {\n    let camera = commands\n        .spawn(Camera2d::default())\n        .insert(ParallaxCameraComponent::default())\n        .id();\n    let event = CreateParallaxEvent {\n        layers_data: vec![\n            LayerData {\n                speed: LayerSpeed::Horizontal(0.9),\n                path: \"cyberpunk_back.png\".to_string(),\n                tile_size: UVec2::new(96, 160),\n                cols: 1,\n                rows: 1,\n                scale: Vec2::splat(4.5),\n                z: 0.0,\n                ..default()\n            },\n            LayerData {\n                speed: LayerSpeed::Horizontal(0.6),\n                path: \"cyberpunk_middle.png\".to_string(),\n                tile_size: UVec2::new(144, 160),\n                cols: 1,\n                rows: 1,\n                scale: Vec2::splat(4.5),\n                z: 1.0,\n                ..default()\n            },\n            LayerData {\n                speed: LayerSpeed::Horizontal(0.1),\n                path: \"cyberpunk_front.png\".to_string(),\n                tile_size: UVec2::new(272, 160),\n                cols: 1,\n                rows: 1,\n                scale: Vec2::splat(4.5),\n                z: 2.0,\n                ..default()\n            },\n        ],\n        camera: camera,\n    };\n    create_parallax.send(event);\n}\n\npub fn move_camera_system(\n    keyboard_input: Res\u003cButtonInput\u003cKeyCode\u003e\u003e,\n    mut move_event_writer: EventWriter\u003cParallaxMoveEvent\u003e,\n    camera_query: Query\u003cEntity, With\u003cCamera\u003e\u003e,\n) {\n    let camera = camera_query.get_single().unwrap();\n    if keyboard_input.pressed(KeyCode::KeyD) || keyboard_input.pressed(KeyCode::ArrowRight) {\n        move_event_writer.send(ParallaxMoveEvent {\n            translation: Vec2::new(3.0, 0.0),\n            rotation: 0.,\n            camera: camera,\n        });\n    } else if keyboard_input.pressed(KeyCode::KeyA) || keyboard_input.pressed(KeyCode::ArrowLeft) {\n        move_event_writer.send(ParallaxMoveEvent {\n            translation: Vec2::new(-3.0, 0.0),\n            rotation: 0.,\n            camera: camera,\n        });\n    }\n}\n```\n\n## Compatible Bevy versions\n\nCompatibility of `bevy-parallax` versions:\n\n| Bevy version | `bevy-parallax` version |\n|:-------------|:------------------------|\n| `0.15`       | `11`                    |\n| `0.14`       | `0.9` - `0.10`          |\n| `0.13`       | `0.8`                   |\n| `0.12`       | `0.7`                   |\n| `0.11`       | `0.5` - `0.6`           |\n| `0.10`       | `0.4`                   |\n\n## Credits\n\n- [Fish World Pack](https://spicylobster.itch.io/fish-world-pack)\n\n- [Warped City 2](https://ansimuz.itch.io/warped-city-2)\n\n- [Mills](https://www.freepik.com/free-vector/flat-wheat-background-with-field_1599667.htm#query=mill%20background%20flat\u0026position=25\u0026from_view=search\u0026track=ais#position=25\u0026query=mill%20background%20flat)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorrosive-games%2Fbevy-parallax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorrosive-games%2Fbevy-parallax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorrosive-games%2Fbevy-parallax/lists"}