material-motion-swift
material-motion-swift copied to clipboard
Explore solutions for ensuring that an object stays within a resistance perimeter
There are two classes of problem with regards to resistance perimeters:
- Velocity. Tossing velocity beyond the perimeter should be affected accordingly. Tossing within the perimeter should have no effect on the velocity until the object moves beyond the perimeter.
- It should not be possible to move beyond the perimeter's maximum length.
Velocity
If we drag beyond a resistance perimeter and release in a direction moving away from the resistance perimeter then we should reduce the velocity accordingly. The current behavior allows you to toss an object while extended beyond the resistance perimeter with full velocity, resulting in the view noticeably extending past the resistance perimeter.
One option: Minimize the finalVelocity if we're beyond the resistance perimeter. This isn't perfect and doesn't solve the case where we're within the perimeter and toss quickly towards the perimeter.
Extending beyond the perimeter
We should never be able to move past the perimeter's maximum length. This is possible if we only apply resistance to the draggable part of a tossable interaction, for example.
One option: introduce an intermediary property in Tossable that we write both draggable and spring to, and then connect a rubber banded stream from that property to the output property. This may be the most promising solution.