r/javascript • • Sep 02 '15

HTML5 Deck of Cards. 100% vanilla JS.

http://pakastin.github.io/deck-of-cards/
368 Upvotes

185 comments sorted by

View all comments

2

u/thecheatah Sep 03 '15

The grabbing algorithm doesn't account for where the card was clicked from, making it twitch and seem unnatural. On click determine the offset and then base moves with the addition of that offset to get a smooth transition.

1

u/pkstn Sep 03 '15 edited Sep 03 '15

Yeah someone else brought that out as well. The problem is that I'm using transform: translate() with percents & pixels mixed, so I can't be certain how much initial offset the card has when dragging starts. I have to fix that one!