Here's an example of the Complexity Explorables, this one is the essence of Keith Haring's Mexican hat that illustrates pattern formation by local excitation and long range inhibition.
All explorables have the same basic structure of code bits.
This file is essentially the header that loads fonts externally and some other stuff:
<link rel="stylesheet" type="text/css" href="widget.v2.2.css" />
: the styles for the widget<link rel="stylesheet" type="text/css" href="styles.css" />
: the styles for the page<link rel="stylesheet" type="text/css" href="stripes.css" />
: the styles for this particular explorable
<script type="text/javascript" src="d3.v4.min.js"></script>
: the version of D3js used in this explorable<script type="text/javascript" src="widget.v2.2.js"></script>
: the js code for the widgets
The js code for the explorable (see below) inserts the display and the control boxes into the DOM here:
<div class="toolbox">
<div id="stripes-display" class="toolbox display-panel"></div>
<div id="stripes-controls" class="toolbox control-panel"></div>
</div>
Finally the explorable code is loaded here:
<script type="text/javascript" src="stripes.js"></script>
and executed
- make a directory
- add all the files to it
- launch a local http server from that directory