Permalink
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (63 sloc) 2.73 KB
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding negative numbers</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="A">randRange( -10, 10 )</var>
<var id="B">randRange( -10, -1 )</var>
</div>
<div class="problems">
<div id="PLUS">
<div class="vars">
<var id="ANSWER">A + B</var>
<var id="PADDING">ceil( ( 10 - ANSWER + A ) / 2)</var>
<var id="START">A - PADDING</var>
<var id="END">ANSWER + PADDING</var>
<var id="REMOVE">[]</var>
</div>
<div class="question">
<code>\Huge\blue{<var>A</var>} + \green{<var>B</var>}=\pink{{?}}</code>
</div>
<div class="solution" data-forms="integer"><var>ANSWER</var></div>
<div class="hints">
<div class="graphie" id="numbers">
init({
range: [ [0, 13], [-4, -1] ]
});
REMOVE = label( [0, -2],
"\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{" + B + "} = {?}}",
"right" );
</div>
<div class="graphie" data-update="numbers">
numberLine( START, END, 1, 1, -3 );
circle( [ 1 + A - START, -3 ], 5/40, { stroke: "none", fill: "#6495ed" } );
</div>
<div class="graphie" data-update="numbers">
style({
stroke: "#28AE7B",
arrows: "-&gt;"
}, function(){
path( [ [ 1 + A - START, -3 ], [ 1 + ANSWER - START, -3] ] );
});
</div>
<div class="graphie" data-update="numbers">
circle( [ 1 + ANSWER - START, -3 ], 5/40, { stroke: "none", fill: "#FF00AF" } );
</div>
<div class="graphie" data-update="numbers">
REMOVE.remove();
label( [0, -2],
"\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{" + B + "} = "
+ "\\color{#FF00AF}{" + ANSWER + "}}",
"right" );
</div>
</div>
</div>
</div>
</div>
</body>
</html>