Search…

s

# Random rotate

0123456789

0123456789

Add some playfulness to your hover effects.

### Notes

In the above example, '21' refers to the range of integers that it will select from. By default this is 0–20 so we subtract 10 to shift the range to between -10 and 10.

If you want a more consistent effect you could edit the random calculation (see below snippet) to exclude numbers between -2 and 2 (where it's hard to perceive the rotation).

```
const randomRotation = () => {
let value = 0
do {
value = Math.floor(Math.random() * 21) - 10
} while (value >= -2 && value <= 2)
return value
}
```

### Help

How do I add code overrides?

Found a bug? Have an idea?