Add edge squash effect #101
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a squash effect when the cursor gets near screen edges. It flattens against them like it's being pressed. Had a lot of fun implementing Hooke's law (https://en.wikipedia.org/wiki/Hooke%27s_law) for the spring physics to get a nice bounce-back feel when you pull away from edges.
In corners it squashes diagonally, transitioning smoothly from horizontal to vertical as you move around. Still not quite happy with how that corner transition feels but it's pretty good.
Config options are distance (how far from edge it triggers), strength (how much squash), corner_radius (when corners kick in), spring_stiffness (bounce-back speed), and spring_damping (prevents wobbling).
I updated the readme but didn't add a video, thought it might make more sense for you to add one so they look consistent with the other demos.
Also made it enabled by default, which might need changing?
Closes #63