All Projects → deck-of-cards → Deck Of Cards

deck-of-cards / Deck Of Cards

Licence: other
Deck of Cards (old version)

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to Deck Of Cards

Hearthstone Deck Tracker
A deck tracker and deck manager for Hearthstone on Windows
Stars: ✭ 4,496 (+67.51%)
Mutual labels:  deck, game, card
Mage
Magic Another Game Engine
Stars: ✭ 1,180 (-56.04%)
Mutual labels:  deck, game, card
Openpanzer
Javascript/HTML5 rewrite of Panzer General 2 game
Stars: ✭ 98 (-96.35%)
Mutual labels:  game, html5
Micro Racing
🚗 🏎️ 🎮 online 3D multiplayer neural networks based racing game
Stars: ✭ 100 (-96.27%)
Mutual labels:  game, html5
Hilo3d
Hilo3d, a WebGL Rendering Engine.
Stars: ✭ 123 (-95.42%)
Mutual labels:  game, html5
Card Game Simulator
Create, Share, and Play
Stars: ✭ 87 (-96.76%)
Mutual labels:  game, card
Shots
🥃 A party drinking game that lets you learn more about your friends: Provider + Hive + swipeable_card
Stars: ✭ 89 (-96.68%)
Mutual labels:  game, card
Searchstone
🃏 Hearthstone's cards search engine built with algolia instantsearch.
Stars: ✭ 117 (-95.64%)
Mutual labels:  game, card
Openetg
Stars: ✭ 32 (-98.81%)
Mutual labels:  game, html5
Allure
Allure of the Stars is a near-future Sci-Fi roguelike and tactical squad combat game written in Haskell; please offer feedback, e.g., after trying out the web frontend version at
Stars: ✭ 149 (-94.45%)
Mutual labels:  game, html5
Kaetram Open
An open-source 2D HTML5 adventure based off BrowserQuest (BQ).
Stars: ✭ 138 (-94.86%)
Mutual labels:  game, html5
Stage.js
2D HTML5 rendering and layout engine for game development
Stars: ✭ 2,138 (-20.34%)
Mutual labels:  game, html5
Tower game
💒 盖楼游戏 html5 canvas tower building game 🏢🏬🏦🏯🏰
Stars: ✭ 1,110 (-58.64%)
Mutual labels:  game, html5
Foda
You are at FODA source code. Play now for free
Stars: ✭ 92 (-96.57%)
Mutual labels:  game, card
Fish
golang h5捕鱼游戏
Stars: ✭ 58 (-97.84%)
Mutual labels:  game, html5
Caveexpress
CaveExpress is a classic 2D platformer with physics-based gameplay and dozens of levels. CavePacker is a Sokoban game.
Stars: ✭ 111 (-95.86%)
Mutual labels:  game, html5
Haxegon
A haxe programming library for beginners. Powered by OpenFL and Starling.
Stars: ✭ 182 (-93.22%)
Mutual labels:  game, html5
Squib
A Ruby DSL for prototyping card games.
Stars: ✭ 850 (-68.33%)
Mutual labels:  game, card
Marmoset
Marmoset is a single-player implementation of the card game SET.
Stars: ✭ 32 (-98.81%)
Mutual labels:  game, card
Tap Tap Adventure
Tap Tap Adventure is a massively online 2D MMORPG set in the medieval times with twists.
Stars: ✭ 123 (-95.42%)
Mutual labels:  game, html5

HTML5 Deck of Cards

Financial Contributors on Open Collective Gitter

NEW VERSION COMING UP!

The new multiplayer Deck of Cards is released at https://deck.of.cards, but will have it's cards library open sourced soon here!

Old version

Pure vanilla JS (+ CSS3) – no dependencies, by Juha Lindstedt & contributors.

https://deck.of.cards/old

Install from Google Chrome Web Store

Frontside card graphics are slightly modified from Chris Aguilar's awesome Vector Playing Card Graphics Set.

Also check out my RE:DOM and HTML5 Node Garden projects!

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

LGPL if you use Chris Aguilar's vector playing cards. Otherwise MIT.

Download

Installation from npm

npm install deck-of-cards

Then add in your html file

  • In <head>:
<link rel="stylesheet" href="node_modules/deck-of-cards/example/example.css">
  • At the end of the <body>:
<script src="node_modules/deck-of-cards/dist/deck.min.js"></script>

Usage

Full example

<html>
    <head>
        <title>Cards</title>

        <link rel="stylesheet" href="node_modules/deck-of-cards/example/example.css">
    </head>
    <body>
        <script src="node_modules/deck-of-cards/dist/deck.min.js"></script>

        <div id="container"></div>

        <script>
            var $container = document.getElementById('container');

            // create Deck
            var deck = Deck();

            // add to DOM
            deck.mount($container);

            deck.cards.forEach(function (card, i) {
                card.setSide(Math.random() < 0.5 ? 'front' : 'back');

                // explode
                card.animateTo({
                    delay: 1000 + i * 2, // wait 1 second + i * 2 ms
                    duration: 500,
                    ease: 'quartOut',

                    x: Math.random() * window.innerWidth - window.innerWidth / 2,
                    y: Math.random() * window.innerHeight - window.innerHeight / 2
                });
            });
        </script>
    </body>
</html>

Available on JsFiddle: http://jsfiddle.net/x0gjood1/

Javascript API

Deck

// Instantiate a deck
var deck = Deck();

// display it in a html container
var $container = document.getElementById('container');
deck.mount($container);

Deck example: http://jsfiddle.net/ec4kcx1k/

// Flip all cards in deck
deck.flip();

// Sort cards
deck.sort();

// Shuffle
deck.shuffle();

// Display fan
deck.fan();

// Remove deck from html container, hide it
deck.unmount();

Shuffle cards and fan: http://jsfiddle.net/favbdkta/

Deck with jokers:

// Instanciate a deck with jokers
var deck = Deck(true);

Card

// Select the first card
var card = deck.cards[0];

// Add it to an html container
card.mount($container);

// Allow to move/drag it
card.enableDragging();
card.disableDragging();

// Allow to flip it
card.enableFlipping();
card.disableFlipping();

// Flip card
card.flip();

// Display card front or back
card.setSide('front');
card.setSide('back');

Draggable and flippable card: http://jsfiddle.net/cgz9mjts/

Card in deck

Remove a card from a deck

var deck = Deck();

// Remove 10 cards starting from the 6th
var removedCards = deck.cards.splice(5, 10);

removedCards.forEach(function (removedCard) {
    removedCard.unmount();
});

Deck without Clubs: http://jsfiddle.net/L25facxj/

Build instructions

npm install
npm start

(starts watching for changes..)

Latest changes

  • 0.1.4 card.animateTo() -method added –> simplier modules! Simple example of usage
  • 0.1.3 JS animations (instead of CSS transitions)
  • 0.1.2 Backside graphics + setRankSuit (+ card.value -> card.rank!)
  • 0.1.1 Better organized modules + Chrome app
  • 0.1.0 Realistic face graphics, notice change of license for now..
  • 0.0.4 winning mode, simpler shuffling, CSS box-shadow change
  • 0.0.3 big refactoring – code now easier to follow and in smaller pieces
  • 0.0.2 made intro shorter & added "poker"
  • 0.0.1 initial version

Where's what?

css/ - CSS source (stylus + nib) of the example

chrome/ - Chrome Web Store app source

dist/ - deck.js & deck.min.js

example/ - https://deck-of-cards.js.org

lib/ - JS (ES6) source of dist/deck.js - deck.js is also the main file

views/ - HTML source of the example

Note to self: todo

  • Make z-index temporary by reordering DOM elements between actions
  • Enhance API, make more flexible

Featured on

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].