There's a good deal to be iterated on here, but this is a great start. Nice work.
- How might someone express resistance in a specific side of an interaction? E.g. Resistance dragging up but not down.
- How is velocity affected by the resistance?
resistanceFactor? Amount makes it seem like it should be a measure in points.
maxResistanceDistance? resistanceRadius makes me think this is measured from the origin, but it's technically measured from resistanceless.
How might someone express resistance in a specific side of an interaction? E.g. Resistance dragging up but not down.
With this implementation, you can apply resistance either radially or linearly (e.g. on an axis-locked gesture). I can't imagine a real case where you'd want to apply radial resistance in some directions but not others. If such a case came up, that would warrant its own thinking.
For linear resistance, you could move the origin and the resistancelessRadius to ensure that only one side of the target had resistance. (For instance, if you were designing the Inbox swipe, you could put the origin on the right edge of the card and have resistancelessRadius be the width of the card. Then, you could freely move the card to the right, but encounter resistance when going left.)
Do you think that's too hacky - do you want to see a more robust/elegant solution?
How is velocity affected by the resistance?
Since the resistance calculations happen upstream of velocity, it should be correct. (That is, if you imagine a situation where resistance wasn't implemented, but the user slowed their drag as if their was, the velocity would be the same as it is here.) Let me know if you see a hole in my thinking here.