boardgame
boardgame copied to clipboard
Some kind of visual representation of shuffling in client
Animation wise there's not TOO much we can do becuase we don't know which card is which. But if we know the stack was shuffled we should show SOME visual cue, even if we just map random cards to each other for the purposes of that one animation.
(How hard will it be to figure out that what happened to a stack was a shuffle?)
Originally captured (ish) in #348
Even just an animation where the cards split even/odd to the left and right and then recombine is fine.
These animations should be captured as an external transform coming from the stack
Actually, the best way to do it is to have two css animations set up for the outer in a card stack: shuffle-left and shuffle-right. If the deck shuffles, then instead of transforming from last location to this one, instead apply shuffle-left (repeat-count
might be multiple), then when it's done remove that class and fire transitionend. (It;'s actually animationend, which is easier: https://developer.mozilla.org/en-US/docs/Web/Events/animationend?)
Will need some way of detecting that a stack has been shuffled, e.g. with a shuffle count?
Stacks grow ShuffleCount() int
which increments every time Shuffle
or SecretShuffle
is called on them. It's included in JSON output, although in stack sanitization it's zero'd out for anything other than PolicyVisible, PolicyOrder, PolicyLen (add a column to the Sanitization Policy reference table)
- [x] ShuffleCount() int on stacks that goes up with each shuffle and is round-tripped through json.
- [x] ShuffleCount() is zero-ed out for PolicyNonEmpty PolicyHidden (update the sanitization documentation table)
- [x] ShuffleCount should not be omitempty
- [ ] In debugAnimations, remove ShuffleCount manually and use the actual shuffle count (maybe not worth it, because I believe that is testing a move that happens after a shuffle)
- [ ] If shuffleCount goes up for a stack and the Ids change, don't do any animation
- [ ] Cards in a stack get set with a left/right property (or, we can just have a selector that is .shuffling [card: even] or whatever)
- [ ] If the shuffleCount goes up on a stack, do the shuffle animation
- [ ] Ensure shuffling of tokens works too