ammunition

0.0.2 • Public • Published

Ammunition.js

This library is currently a work in progress. Modern cartridges drawn to specifcations with D3v4. Dimensions are based on SAAMI with tolerances averaged. Only specifications for SAAMI pistol and rifle cartridges are presently available.

Installation

  1. Install package
npm install ammunition
  1. Include d3v4 and ammunition.js on your page.
<script src="path/to/d3.js" />
<script src="path/to/ammunition.js" /> 

Usage

To draw a cartridge:

<script>
 
let round = new Ammo({
      element: document.querySelector('.foo'),
      name:'7.62x39',
      bullet: 'rifle',
      stroke: '#323232'
    });
 
</script> 
 
<div class="foo"></div>

element: Specifies the element the cartridge SVG is to be drawn on.

name: Specifies which cartridge to be drawn. Name is based on SAAMI nomenclature.

bullet: type of bullet on cartridge. Currently only supports rifle and standard (round nose type). If left empty will default to value in specification.

stroke Specifies the stroke color of cartridge. Defaults to #333 if left blank.

LICENSE

MIT

Package Sidebar

Install

npm i ammunition

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • gao8a