Skip to content
Back to skills

Camera Shake

ASecurity

Shake the camera when the player takes damage or on impacts for visual feedback.

  • 31 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added May 27, 2026
developmentgit

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add verekia/r3f-gamedev --skill camera-shake --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Camera Shake?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Camera Shake
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/verekia-camera-shake/badge)](https://www.skillsdirectory.com/skills/verekia-camera-shake)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: camera-shake
description: Shake the camera when the player takes damage or on impacts for visual feedback.
---

# Camera Shake

Shake the camera when the player takes damage or on impacts for visual feedback.

## Technique

Instantly offset the camera's rotation on X (pitch) and Z (roll) axes, then smoothly return to the base rotation using exponential decay in `useFrame`.

## Key Concepts

- Store rotation offsets in a module-level object for external triggering
- Use exponential smoothing: `(target - current) * (1 - Math.exp(-speed * dt))`
- Apply offsets to `camera.rotation.x` and `camera.rotation.z`
- Call `shake(intensity)` from anywhere to trigger the effect

## Usage

```tsx
const shake = (intensity = 0.05) => {
  rotationOffset.x = (Math.random() - 0.5) * intensity
  rotationOffset.z = (Math.random() - 0.5) * intensity
}

// In useFrame:
rotationOffset.x += addSmoothExp(rotationOffset.x, 0, 10, delta)
camera.rotation.x = rotationOffset.x
```

## Related Skills

- `smooth-interpolation` - Exponential smoothing formula details

---

This skill is part of [verekia](https://x.com/verekia)'s [**r3f-gamedev**](https://github.com/verekia/r3f-gamedev).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.