sandpit
Version:
A playground for creative coding using JavaScript and the canvas element
703 lines (181 loc) • 9.47 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Mathematics - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/tonsky/FiraCode/1.205/distr/fira_code.css" />
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h3><a href="index.html">⛱ Sandpit</a></h3><h3></h3><ul><li><a href="tutorial-01-documentation.html"> Documentation</a></li><li><a href="tutorial-02-inspiration.html"> Inspiration</a></li></ul><h3>Classes</h3><ul><li><a href="Color.html">Color</a></li><li><a href="Is.html">Is</a><ul class='methods'><li data-type='method'><a href="Is.html#.array">array</a></li><li data-type='method'><a href="Is.html#.canvas">canvas</a></li><li data-type='method'><a href="Is.html#.element">element</a></li><li data-type='method'><a href="Is.html#.object">object</a></li></ul></li><li><a href="Mathematics.html">Mathematics</a><ul class='methods'><li data-type='method'><a href="Mathematics.html#.randomBetween">randomBetween</a></li><li data-type='method'><a href="Mathematics.html#.randomFrom">randomFrom</a></li></ul></li><li><a href="Sandpit.html">Sandpit</a><ul class='methods'><li data-type='method'><a href="Sandpit.html#clear">clear</a></li><li data-type='method'><a href="Sandpit.html#clearQueryString">clearQueryString</a></li><li data-type='method'><a href="Sandpit.html#fill">fill</a></li><li data-type='method'><a href="Sandpit.html#get">get</a></li><li data-type='method'><a href="Sandpit.html#random">random</a></li><li data-type='method'><a href="Sandpit.html#resizeCanvas">resizeCanvas</a></li><li data-type='method'><a href="Sandpit.html#setupStats">setupStats</a></li><li data-type='method'><a href="Sandpit.html#start">start</a></li><li data-type='method'><a href="Sandpit.html#stop">stop</a></li></ul></li><li><a href="Stats.html">Stats</a></li><li><a href="Vector.html">Vector</a></li></ul><h2 class="version">v0.1.15</h2>
</nav>
<div id="main">
<h1 class="page-title">Mathematics</h1>
<section>
<header>
<h2>
Mathematics
</h2>
<div class="class-description"><p>A utility for math stuff</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Mathematics"><span class="type-signature"></span>new Mathematics<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_Mathematics.js.html">utils/Mathematics.js</a>, <a href="utils_Mathematics.js.html#line6">line 6</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".HALF_PI"><span class="type-signature">(static) </span>HALF_PI<span class="type-signature"></span></h4>
<div class="description">
<p>Returns PI / 2</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_Mathematics.js.html">utils/Mathematics.js</a>, <a href="utils_Mathematics.js.html#line10">line 10</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".QUARTER_PI"><span class="type-signature">(static) </span>QUARTER_PI<span class="type-signature"></span></h4>
<div class="description">
<p>Returns PI / 4</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_Mathematics.js.html">utils/Mathematics.js</a>, <a href="utils_Mathematics.js.html#line12">line 12</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".TWO_PI"><span class="type-signature">(static) </span>TWO_PI<span class="type-signature"></span></h4>
<div class="description">
<p>Returns PI * 2</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_Mathematics.js.html">utils/Mathematics.js</a>, <a href="utils_Mathematics.js.html#line8">line 8</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".randomBetween"><span class="type-signature">(static) </span>randomBetween<span class="signature">(min, max)</span><span class="type-signature"> → {int|float}</span></h4>
<div class="description">
<p>Returns a number between min and max</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>min</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The minimum range</p></td>
</tr>
<tr>
<td class="name"><code>max</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The maximum range</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_Mathematics.js.html">utils/Mathematics.js</a>, <a href="utils_Mathematics.js.html#line20">line 20</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random number between min and max</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">int</span>
|
<span class="param-type">float</span>
</dd>
</dl>
<h4 class="name" id=".randomFrom"><span class="type-signature">(static) </span>randomFrom<span class="signature">(object)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
<p>Returns a random element in an array or object</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">array</span>
|
<span class="param-type">object</span>
</td>
<td class="description last"><p>The array or object</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_Mathematics.js.html">utils/Mathematics.js</a>, <a href="utils_Mathematics.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The array item or object value</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> using a modified <a href="https://github.com/nijikokun/minami">Minami</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>