GithubHelp home page GithubHelp logo

morantron / cronut-factory Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mllocs/cronut-factory

0.0 2.0 0.0 204 KB

Simple javascript library to draw cronuts in the web.

License: MIT License

JavaScript 100.00%

cronut-factory's Introduction

Cronut Factory

This is a simple javascript library to draw cronuts in the web. Depends on Raphael which uses the SVG W3C Recommendation and VML as a base for creating graphics.

API

CronutFactory.create(options)

CronutFactory.create receives options (Object) with the following attributes:

Parameters

container HTMLElement

The DOM Element where the cronut will be drawn.

width Number

Width (in pixels) of the Raphael's paper.

height Number

Height (in pixels) of the Raphael's paper.

radius Number

Cronut radius in pixels.

stroke_width Number (optional)

Default Cronut stroke width in pixels (default: 1).

stroke String (optional)

Default Cronut stroke color (default: '#FF0000').

archs Array<Object>

Array of cronut archs. Every arch has the following properties:

  • value Number: Arch weight.
  • css_class String: Arch css class that will be added to the path element.
  • stroke String: Arch stroke color.
  • stroke_width Number: Arch stroke width.

Example

  CronutFactory.create({
    container: document.getElementById('simple-cronut')
  , width: 500
  , height: 500
  , radius: 200
  , stroke_width: 100
  , stroke: 'violet'
  , archs: [
      {value: 10, css_class: 'path-1', stroke: 'green',  stroke_width: 60}
    , {value: 20, css_class: 'path-2', stroke: 'orange', stroke_width: 70}
    , {value: 30, css_class: 'path-3', stroke: 'blue',   stroke_width: 80}
    , {value: 40, css_class: 'path-4', stroke: 'red',    stroke_width: 90}
    , {value: 50}
    ]
  });

cronut-factory's People

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.