Skip to content
Back to skills

Pushback

ASecurity

Make enemies flash white and rock back and forth when receiving damage.

  • 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 pushback --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pushback?

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

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

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: pushback
description: Make enemies flash white and rock back and forth when receiving damage.
---

# Pushback

Make enemies flash white and rock back and forth when receiving damage.

## Technique

Track pushback state with a direction vector and progress value. In `useFrame`, interpolate the position along the pushback direction using a back-and-forth curve, and change the material color to white during the effect.

## Key Concepts

- Store pushback direction (`dx`, `dy`) and progress (0 to 1)
- Use a triangle wave for back-and-forth motion: `t < 0.5 ? t * 2 : (1 - t) * 2`
- Flash material color to white during pushback
- Reset to original position and color when complete
- Direction should be opposite to the damage source (player position)

## Usage

```tsx
const pushbackRef = useRef<{ dx: number; dy: number } | null>(null)
const pushbackProgress = useRef(0)

useFrame((_, delta) => {
  if (pushbackRef.current) {
    pushbackProgress.current += delta * 8
    material.color.set('white')

    const t = pushbackProgress.current
    const offset = t < 0.5 ? t * 2 : (1 - t) * 2
    mesh.position.x = baseX + pushbackRef.current.dx * offset
  }
})
```

---

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.

View all in development →

Comments

Loading comments…

Newsletter

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