r/InternetIsBeautiful • u/Onegodoneloveoneway • Sep 04 '15
HTML5 Deck of Cards
http://pakastin.github.io/deck-of-cards/38
u/BadThoughtProcess Sep 04 '15
If you could host multiple people and have the option of putting the cards face-down, this would be cooler.
6
3
u/fire1299 Sep 05 '15
1
u/pielover88888 Sep 06 '15
This works in IE11 and not in Chrome 44. The hell?
Edit: Windows 8.1 IE11 lets me see the suit, Windows 7 IE11 shows blankness in the middle of the cards, and the number of the cards in the corner
2
u/pkstn Sep 06 '15
Should work now!
1
-13
Sep 04 '15
I chuckled.
That's like people who say, "Yeah, this is good, but it would be better if it did something it was never designed to do"
Like people who request MP for SP games.
20
u/Onegodoneloveoneway Sep 04 '15
It would be better if it was designed to do something that's fairly common when using cards.
10
6
12
Sep 05 '15
[removed] — view removed comment
5
u/silentclowd Sep 05 '15
I just want to say, I have gotten more value out of this game than nearly anything else I got on steam. It is a thousand and one games plus every game you can think of. It's amazing, and I highly suggest anyone to get it.
2
u/ElectroBoof Sep 05 '15
Question: I have no friends on Steam, would this be worth buying without people to play with?
3
1
u/silentclowd Sep 05 '15
Probably not? I've managed to find something to fuck around with for a few hours but nothing substantial.
0
7
Sep 05 '15
I'm happy they did human-like shuffles.
Most card simulators (used in games or otherwise) will give you a completely randomized deck on a single shuffle. Nice for speed, shit for realism.
With this, you can sort the cards, shuffle once, fan them, and you'll still see patterns throughout.
4
u/pkstn Sep 05 '15
Here's the shuffling function if you're interested: https://github.com/pakastin/deck-of-cards/blob/master/lib/deck-shuffle.js#L24
1
u/Onegodoneloveoneway Sep 05 '15
What do you develop your javascript in? I'm using Notepad++, but my projects are typically simple things that I cram into one file.
5
1
1
1
2
u/Raptor68 Sep 05 '15
Found a cool easter egg, at least confirmed on mobile. Press "By Suit", then drag the ace cards only to the left of the screen, one by one. (Might work other ways as well)
2
u/Onegodoneloveoneway Sep 05 '15
Just click the Aces one by one. If only you could stop it though!
2
2
30
u/littlep2000 Sep 04 '15
I just want it to do the Windows Solitaire win screen.
64
u/tomcatfish Sep 04 '15
34
Sep 05 '15
hold down mouse button
move mouse all over the screen
(゚ヮ゚)
15
u/VonZigmas Sep 05 '15
Or better yet, do it on a tablet with two fingers or more :D
9
2
4
4
u/VonZigmas Sep 05 '15
I'm on my iPad and was not expecting it to register two fingers. ...or all ten. I love this.
4
Sep 05 '15
that is absolutely amazing, this is so much fun. I wish I could put this as my desktop, that way when i'm bored I can just throw cards around as opposed to the stupid squares I make with the mouse.
1
3
2
1
12
Sep 04 '15
Can you turn cards face down?
13
u/pkstn Sep 04 '15
Yes I can, but that's in developing..
2
u/ShortBusBully Sep 05 '15
I assume from your posts you are the creator? How hard was it t code this all in HTML5? Do you feel the technology is getting caught up to more modern terms or does it still have a long ways to go? I'm very curious because I develop games and always found HTML5 to be very basic for web ports.
9
u/pkstn Sep 05 '15
Hi! Yeah I did this.. It was actually pretty easy to develop, BUT this is 3rd generation already (Flash, AngularJS, VanillaJS) so all the basic logic was there.
Check out source code here: http://github.com/pakastin/deck-of-cards/tree/master/lib
It should be pretty straightforward to follow - just start from deck.js ;)
25
7
6
u/PosterToBeNamedLater Sep 05 '15
This is one of the coolest things I've seen on Reddit this Summer. Great work
5
5
u/tishlish Sep 05 '15
I have absolutely no use for this, but got some weird satisfaction out of the fact that somebody took the time to design such a clean and simple tool. The internet is indeed beautiful, my friends.
4
4
u/meshan Sep 04 '15
What, no red cards?
2
u/pkstn Sep 04 '15
Which browser are you using?
3
u/meshan Sep 04 '15
Dolphin. All the hearts and diamonds are black
3
u/pkstn Sep 05 '15
That's really weird and I think you're first.. Never heard of Dolphin browser though - maybe you should try another browser?
I will check that out though..
1
2
u/tanzoniteblack Sep 05 '15
The hearts and diamonds are black for me as well on chrome for Android.
2
u/pkstn Sep 05 '15
Ok, have to grab android somewhere then..
1
u/tanzoniteblack Sep 05 '15
For the note: Still cool and fun to play around with even with the colors being screwy!
1
1
u/pkstn Sep 06 '15
Should work now!
1
2
1
u/PhilipT97 Sep 05 '15
Shows red for me in Firefox beta for android, but black in chrome for android and reddit Relay's web view
2
u/pkstn Sep 06 '15
Should be fixed now!
1
1
1
3
2
Sep 04 '15
Very nicely done! Not sure if it's a bug or a feature, but sometimes the object goes under another object while being moved and sometimes over.
3
2
Sep 04 '15
This is good. Usually demos like this, whenever someone drags an item it lags like a motherfucker. Very smooth :)
2
2
Sep 05 '15
I got a flush!
2
u/pkstn Sep 05 '15
Nice! My best is two pairs :(
1
Sep 05 '15
i also got a three of a kind!
2
u/pkstn Sep 05 '15
When I was a little we used to say when playing games with friends that "The creator must be truly awesome in this game!" - now when I'm older I know it's the opposite :)
1
2
2
Sep 05 '15
I think it would actually work well for playing solitaire, if a multi-select/drag-to-select feature were added.
1
2
u/PeachyLou Sep 05 '15
How did they program realistic shuffling... This is insane
1
u/pkstn Sep 05 '15
That's basically just a combination of slightly differently delayed transitions and animating the z position as well :)
2
u/Trevor_Roll Sep 05 '15
I pressed the 'poker' button and it dealt a straight flush, a message box appeared saying I had won a prize!
3
u/pkstn Sep 05 '15
The creator here: I don't believe you about the message box part :D
2
u/Trevor_Roll Sep 05 '15
Come on man. Read my username. ur no fun :)
2
2
u/darkstar161 Sep 05 '15
This is awesome! I do miss the ability to had the deck closed and be able to open 1 card at the time. I'd love to use it for a drinking game when we forget to bring a deck IRL.
2
2
2
u/turkeypedal Sep 05 '15
/u/plstn: I think you could improve it by adding two features: One, the ability to click (or tap) on a card and flip it over. (You may want to include some inertia so the mouse can move slightly without moving the card)
And you need the ability to click something that will let you move the deck. Maybe make a lasso selection tool that will move all cards it selects? And then have a "flip the deck" button.
At least, that's how I've always imagined this to work. From there, you can pretty much play any one-player card game like you would with real cards. (Multiplayer would be a whole other ball game.)
BTW, nice job having the shuffle button work like a real rifle shuffle, instead of just randomly sorting the cards. At least, my first shuffle didn't really randomize at all.
1
2
1
1
u/thecomputerscientist Sep 05 '15
Very cool! I feel like the canvas element would be better suited to this task, though. Well done in any case.
1
Sep 05 '15
Why are all the cards the same color? Shouldn't the hearts and diamonds be red at least?
1
1
1
1
u/zombarista Sep 05 '15
What's remarkable is that if i click "shuffle" and then "fan," the order appears to follow through.
1
1
u/decayf6969 Sep 05 '15
Can you turn cards face down?
1
u/pkstn Sep 05 '15
Soon you can.. Check out the original version: http://pakastin.fi/cards_2006 (you'll need Flash)
1
u/TheSlimyDog Sep 05 '15
I love playing with things like this on mobile especially when they work just as well (if not better)
1
1
1
1
1
u/Douude Sep 05 '15
It looks captivating
1
u/pkstn Sep 05 '15
Thanks! :)
1
u/Douude Sep 05 '15
I was just watching it for multiple minutes. How did you find it
1
u/pkstn Sep 05 '15
Found what..?
1
u/Douude Sep 05 '15
The card thing, the creator has done a nice jobs. The movement thosen't look weird and is very subtle and fluent.
1
1
u/beefzilla Sep 05 '15
My card arc animation isn't as smooth, but the cards are bigger. One day I'll re optimize it.
1
1
Sep 05 '15
i am.
actually amazed at this.
i mean. once you get it working with two cards it should hypothetically work with all of them, but as anyone who's programmed knows......
hypothetical really means "god fucking damnit."
-1
u/lespaulstrat2 Sep 04 '15
Nice but it is not HTML 5 doing the work it is Javascript.
<script src="dist/deck.min.js"></script>
<script src="example.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
For anyone interested there are a ton of scripts for this.
7
u/pkstn Sep 05 '15
<!DOCTYPE html> on top of the page defines it HTML5, it's that simple. What's your problem?
→ More replies (3)→ More replies (13)5
u/pkstn Sep 04 '15
Javascript is a very crucial part of HTML5. For example application cache, localstorage, etc...
→ More replies (2)
0
u/garlicar88 Sep 05 '15
Why are all the cards the same color? Shouldn't the hearts and diamonds be red at least?
1
0
117
u/Onegodoneloveoneway Sep 04 '15 edited Sep 05 '15
I realise we shouldn't be posting webgames here, but this didn't strike me as a game so much as a minimally and well designed deck of cards tool.
EDIT: Looks like the creator /u/pkstn has shown up for the discussion! Nice work, and I love that you're getting some good feedback from this thread.