Giter VIP home page Giter VIP logo

cardsjs's Introduction

cardsJS

Travis build status npm version

Showing playing cards that are scalable in a browser is possible with cardJS. See the web site for some examples and the wiki for documentation.

I'm using the Vectorized Playing Cards 1.3 designed by Chris Aguilar, see the readme file for the details. The original SVGs are changed to not render in an A4 page, but to fit to size.

The change log is automatically produced with the help of semantic-release.

Getting started

cardsJS is available for Node.js and most modern browsers. If you want to know if your currrent browser is compatible, run the online test suite.

Install with npm

> npm install cardsJS --save

Browser

Include the package from the unpkg CDN

<link rel="stylesheet" type="text/css" href="https://unpkg.com/cardsJS/dist/cards.min.css" />

<script src="https://unpkg.com/cardsJS/dist/cards.min.js" type="text/javascript"></script>

Cards

Use the <img class='card' src='cards/id.svg'> HTML tag; where id is the identifier of the card. The id is composed of the rank and then the suit of the card, e.g. 'KS' is the King of spades. The suits are 'S', 'H', 'D' and 'C' for spades, hearts, diamonds and clubs. The rank '10' of a suit x is either '10x' or 'Tx'.

The king of spades is rendered as <img class='card' src='cards/KS.svg'>.

Hands

Cards can be grouped into a hand. A hand is a <div class='hand'> containing the card(s). With an active hand, <div class='hand active-hand'>, moving the mouse over a card will move it veritically/horizontally to indicate that the card will be selected.

<div class="hand hhand-compact active-hand">
    <img class='card' src='cards/AS.svg'>
    <img class='card' src='cards/KS.svg'>
    <img class='card' src='cards/QS.svg'>
    <img class='card' src='cards/JS.svg'>
    <img class='card' src='cards/10S.svg'>
    <img class='card' src='cards/9H.svg'>
    <img class='card' src='cards/3H.svg'>
</div>

A hand can also be declared with the data-hand attribute, see Controlling the hand for more details. Also see Controlling the fan

<div class="hand active-hand"
     data-hand="flow: horizontal; cards: AS,KS,QS,JS,10S,9H,3H">
</div>

Hello world

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="cards.css">
    <title>Hello CardsJS</title>
  </head>
  <body>
  <p>
    The king of spades is rendered as <img class='card' src='cards/KS.svg'>.
  </p>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
  <script src="cards.js"></script>
  </body>
</html>

Run the hello world sample using rawgit.

License

Copyright © 2015 Richard Schneider ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cardsjs's People

Contributors

richardschneider avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.