GithubHelp home page GithubHelp logo

ebabel-eu / generic-dice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ernes/generic-dice

0.0 2.0 0.0 118 KB

Generic dice to add to your games

License: GNU General Public License v3.0

CSS 28.75% JavaScript 71.25%

generic-dice's Introduction

Generic-Dice wercker status generic-dice

Generic dice to add to any game using React.js

Note: this dice is purely a display component, it will not try to pick a random value. Instead, it needs to be set with a value and it will display it. The dice can also be animated to show that set value.

The main part component of this module is <GenericDice> but it's possible to use it as just <Dice> or any tag name that is suitable in your jsx.

Install

npm install generic-dice --save

Usage

Basic dice

Simplest dice without any value set (all defaults).

The code below display a single dice on its own. This same dice could also be mixed with other components, it doesn't have to be displayed by itself.

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <Dice />
), document.getElementById('game'));

Dice with a value set in face property

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <Dice face={6} />
), document.getElementById('game'));

Dice with a value, not rolling when first displayed and with a custom size of 10 pixels

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <Dice face={5} rolling={false} size={10} />
), document.getElementById('game'));

Mixing several dices

import React from 'react';
import { render } from 'react-dom';

import Dice from 'generic-dice';

render((
  <div>
    <Dice />
    <Dice face={6} />
    <Dice face={5} rolling={false} size={10} />
  </div>
), document.getElementById('game'));

Maintainers

  • Ernesto Paniagua: Developer and Designer
  • Nadjib Amar: Developer

Please fork this repository and improve our code; pull requests are welcome.

The main repository also has a list of issues, feel free to report new issues as you find them.

Documentation and unit testing are good starting points to contribute to this repository, but if you have some features you want to add to it, feel free to do so.

Further development

If you want to develop this component further, please see the Development help file.

Change log

generic-dice's People

Contributors

ebabel-eu avatar ernes avatar

Watchers

 avatar  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.