r/webdev • • Sep 03 '15

HTML5 Deck of Cards

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

20 comments sorted by

3

u/stark0788 Sep 03 '15

Very cool - but there should be a feature to flip the card over - would allow you to play a plethora of card games.

2

u/pkstn Sep 04 '15

Thanks! That's coming.. ;)

1

u/stark0788 Sep 04 '15

I'm gonna branch off this and see if I can implement something

2

u/pkstn Sep 04 '15 edited Sep 04 '15

Oh, I just made a big update – please pull the new version first..

1

u/stark0788 Sep 23 '15

I just now noticed this - OP delivered. Here's another challenge - you've got all these nice animations for the shuffling / sorting...what about an animation for the flip? Vs. just having the opposing side instantly appear

1

u/pkstn Sep 23 '15

I'm working on it..it's not the easiest task to make a realistic flip - I don't want to just rotate around Y-axis like everyone does..

1

u/pkstn Sep 03 '15

Thanks scotchio for adding this here as well 👍

3

u/[deleted] Sep 03 '15

Saw this on HN earlier. Loved it! Great stuff. Thanks for sharing

1

u/pkstn Sep 04 '15

No worries! It has already inspired people to make their own card games/tests, so mission accomplished! :)

2

u/jamdlaw Sep 03 '15

great job! I shared this with the others I work with.

1

u/pkstn Sep 04 '15

Thank you! Appreciate it..

2

u/cbleslie Sep 03 '15

Neat. The only real improvement you could have passed suit as a class to the card.

1

u/pkstn Sep 04 '15

I could do that of course, but I don't see the point..?

1

u/cbleslie Sep 06 '15

What's the point of describing a card as red, or black? Why not just describe the suit and let it pass its symbol as part of its identity. Jokers are neither red nor black. So why not just accept stronger more semantic way of passing your classes. Black is just a property. Why not just describe identity of the card, like: This is a "card" let it inherit the identity of a "spade". JS shouldn't care about colors, or symbols. It should just care about value and suit. Let css present what that should look like.

I hope that's clear enough?

1

u/pkstn Sep 06 '15 edited Sep 06 '15

That's a great idea! I will do that. The reason I used .card and .card.red was that the suit is showed in HTML as a text and at current there's no need for suit to have their own style apart from the color, but you proved your point about the semantics.

Also makes JS even simplier.

Thanks!

1

u/pkstn Sep 06 '15

You'd also need them if you'll use some premade graphic files with kings, queens, jacks.. makes totally sense!

1

u/pkstn Sep 06 '15

Fixed now!

1

u/pkstn Sep 08 '15

Added better graphics and a couple of easter eggs..see if you can find them :) https://deck-of-cards.js.org