{"id":15691594,"url":"https://github.com/johanhelsing/bevy_trauma_shake","last_synced_at":"2025-05-07T23:24:04.366Z","repository":{"id":207841403,"uuid":"720223663","full_name":"johanhelsing/bevy_trauma_shake","owner":"johanhelsing","description":"A Bevy plugin for shaking 2d cameras","archived":false,"fork":false,"pushed_at":"2024-02-23T14:36:40.000Z","size":26,"stargazers_count":8,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-26T06:04:03.552Z","etag":null,"topics":["2d","bevy","camera","camera-shake","game-development"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johanhelsing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2023-11-17T21:26:38.000Z","updated_at":"2024-07-12T16:45:25.679Z","dependencies_parsed_at":null,"dependency_job_id":"dee13119-dbd6-4492-8632-fc49c825ba7c","html_url":"https://github.com/johanhelsing/bevy_trauma_shake","commit_stats":null,"previous_names":["johanhelsing/bevy_trauma_shake"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_trauma_shake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_trauma_shake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_trauma_shake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_trauma_shake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johanhelsing","download_url":"https://codeload.github.com/johanhelsing/bevy_trauma_shake/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223817760,"owners_count":17207947,"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":["2d","bevy","camera","camera-shake","game-development"],"created_at":"2024-10-03T18:22:26.024Z","updated_at":"2025-05-07T23:24:04.354Z","avatar_url":"https://github.com/johanhelsing.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy_trauma_shake\n\n[![crates.io](https://img.shields.io/crates/v/bevy_trauma_shake.svg)](https://crates.io/crates/bevy_trauma_shake)\n![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)\n[![crates.io](https://img.shields.io/crates/d/bevy_trauma_shake.svg)](https://crates.io/crates/bevy_trauma_shake)\n[![docs.rs](https://img.shields.io/docsrs/bevy_trauma_shake)](https://docs.rs/bevy_trauma_shake)\n\nAdd camera shakes to your 2d Bevy game with three lines of code.\n\n## Goals\n\n- Zero configuration required\n- Sensible defaults\n- Batteries included (default noise)\n- Compatible with bevy_pancam\n\n## Usage\n\nAdd the plugin:\n\n```rust ignore\napp.add_plugins(TraumaPlugin);\n```\n\nSimply add a component to your camera:\n\n```rust ignore\ncommands.spawn((Camera2d, Shake::default()));\n```\n\nMake it shake:\n\n```rust ignore\nfn shake(mut shake: Single\u003c\u0026mut Shake\u003e, keys: Res\u003cButtonInput\u003cKeyCode\u003e\u003e) {\n    if keys.just_pressed(KeyCode::Space) {\n        shake.add_trauma(0.2);\n    }\n}\n```\n\nThere is also a convenience system param for applying trauma to all `Shake`s:\n\n```rust ignore\nfn shake(mut shake: Shakes, keys: Res\u003cButtonInput\u003cKeyCode\u003e\u003e) {\n    if keys.just_pressed(KeyCode::Space) {\n        shakes.add_trauma(0.2);\n    }\n}\n```\n\nAnd an event, if you prefer that:\n\n```rust ignore\nfn shake(mut trauma: EventWriter\u003cTraumaEvent\u003e, keys: Res\u003cButtonInput\u003cKeyCode\u003e\u003e) {\n    if keys.just_pressed(KeyCode::Space) {\n        trauma.send(0.2.into());\n    }\n}\n```\n\nAnd even a command:\n\n```rust ignore\nfn shake(mut commands: Commands, keys: Res\u003cButtonInput\u003cKeyCode\u003e\u003e) {\n    if keys.just_pressed(KeyCode::Space) {\n        info!(\"Adding small trauma\");\n        commands.add_trauma(0.2);\n    }\n}\n```\n\nMaybe I went a little overboard and I should remove one of those ways, in any case, they can be toggled through the features: `system_param`, `events`, `commands`.\n\n## Optional configuration\n\nOptionally add `ShakeSettings`, if you're not happy with the defaults.\n\n```rust ignore\n    commands.spawn((\n        Name::new(\"Camera\"),\n        Camera2dBundle::default(),\n        Shake::default(),\n        ShakeSettings {\n            amplitude: 200.,\n            trauma_power: 3.,\n            decay_per_second: 0.3,\n            frequency: 4.,\n            octaves: 2,\n        },\n        PanCam::default(),\n    ));\n```\n\n## Bevy Version Support\n\nThe `main` branch targets the latest bevy release.\n\n|bevy|bevy_trauma_shake|\n|----|-----------------|\n|0.16|0.5, main|\n|0.15|0.4|\n|0.14|0.3|\n|0.13|0.2|\n|0.12|0.1|\n\n## License\n\n`bevy_trauma_shake` is dual-licensed under either\n\n- MIT License (./LICENSE-MIT or \u003chttp://opensource.org/licenses/MIT\u003e)\n- Apache License, Version 2.0 (./LICENSE-APACHE or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n\nat your option.\n\n## Thanks\n\n- \u003chttps://www.youtube.com/watch?v=tu-Qe66AvtY\u003e\n- [`bevy_camera_shake`](https://github.com/Andrewp2/bevy_camera_shake): 2D and 3D shakes and more configuration options. I used this a lot for reference, but I wanted a simpler API.\n\n## Contributions\n\nPRs welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanhelsing%2Fbevy_trauma_shake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohanhelsing%2Fbevy_trauma_shake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanhelsing%2Fbevy_trauma_shake/lists"}