Skip to content

Instantly share code, notes, and snippets.

@ctlusto
Last active October 18, 2015 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctlusto/86b24d1d3d5e7ecd673d to your computer and use it in GitHub Desktop.
Save ctlusto/86b24d1d3d5e7ecd673d to your computer and use it in GitHub Desktop.
Basic Desmos Example

A basic example of embedding a Desmos calculator using their API.

html,
body,
#calculator {
width: 100%;
height: 100%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Basic Desmos Example</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div id="calculator"></div>
<script src="//www.desmos.com/api/v0.5/calculator.js?apiKey=dcb31709b452b1cf9dc26972add0fda6"></script>
<script src="index.js"></script>
</body>
</html>
var elt = document.getElementById('calculator');
var calc = Desmos.Calculator(elt);
calc.setExpressions([
{
id: 'parameter',
latex: 'a = 1'
},
{
id: 'parabola',
latex: 'y = ax^2',
color: Desmos.Colors.PURPLE
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment