FractionPainter is a Javascript based tool that draws fractions using circles. It helps explain the meaning of Fraction.
License: MIT License
Let's paint
-
Download fractionpainter.js file and include in your code
<script src="fractionpainter.js"></script>
-
Add the element where you want the fraction appear: a div or a span
<div id="fraction_container1"></div>
-
Call the
paint
method of thefractionPainter
object: this takes the element selector as the first argument and the options as the second argument.fractionPainter.paint("#fraction_container1", {width: 800, height: 450, numerator: 10, denominator: 3});
and that's all (see example.html):
FractionPainter has some options that can be passed when the method paint
is called.
-
numerator
(default is 1) -
denominator
(default is 2) -
width
set the canvas width -
height
set the canvas height