Earlier quoted context omitted.
Font should be Open Sans.. I have Chrome/Mac and it's working :/
Why spend the time and effort pulling a custom font across the wire if you're only going to use symbols that exist in the web safe fonts included with the browser? Seems kinda wasteful.
HTML5 Deck of Cards
31–40 of 165 posts
Re: HTML5 Deck of Cards
#32Re: HTML5 Deck of Cards
#33Re: HTML5 Deck of Cards
#34Re: HTML5 Deck of Cards
#35Earlier quoted context omitted.
I think "value | 0" is basically same as "Math.floor(value)"
Yes, but it is 18% faster do run the bitwise or on my machine: https://jsperf.com/or-vs-floor/2
Math.floor() favors the number equal to/less than the parameter, Math.floor(-15.5) is -16 while (-15.5 | 0) is -15
Also because the returned value is int32[0],
Math.floor(2147483648.5) is 2147483648 while (2147483648.5 | 0) is -2147483648
You are fine if you know the input is less than (2^31) + 1 and you want to truncate, rather than floor.
[0]: http://www.ecma-international.org/ecma-262/6.0/#sec-binary-b...
Re: HTML5 Deck of Cards
#36Re: HTML5 Deck of Cards
#37Re: HTML5 Deck of Cards
#38There's one card face missing. That's the back! A nice card back might be a more difficult challenge to do in HTML5.
https://desandro.github.io/3dtransforms/examples/card-01.htm...
#card.flipped { -webkit-transform: rotateY( 180deg ); -moz-transform: rotateY( 180deg ); -o-transform: rotateY( 180deg ); transform: rotateY( 180deg ); }
Re: HTML5 Deck of Cards
#39Maybe it's a weird takeaway, but this line is really clever: var suit = i / 13 | 0; That's such a clean way to get a 0, 1, 2 or 3 from each card's `i` and I never would have thought of it.
In asmjs you see this sort of syntax 'num | 0' a lot [0] to enforce that the number is an int, so that may be where he got the idea. [0] http://www.sitepoint.com/understanding-asm-js/
Re: HTML5 Deck of Cards
#40Each of these cards could probably be made with one element and some CSS3 pseudo-element selectors, as opposed to the four elements (wrapper element and three child elements) that are currently used per card. Additionally, with three elements (possible just one if you're crazily good at CSS), it'd be possible to have flippable cards. Still just using CSS3. Edit: Can someone explain these downvotes for me?
I suck at pseudo-elements – that's why.. :)