diff --git a/demo.js b/demo.js
index a6c60c4..269074a 100644
--- a/demo.js
+++ b/demo.js
@@ -1,5 +1,11 @@
-var structure;
+requirejs.config({
+ 'baseUrl' : 'src'
+});
+
+require(['pv', 'mol/all', 'io', 'shade', 'viewpoint'],
+ function(pv, mol, io, color, viewPoint) {
+var structure;
function lines() {
viewer.clear();
@@ -13,7 +19,7 @@ function cartoon() {
var go = viewer.cartoon('structure', structure, {
color : color.ssSuccession(), showRelated : '1',
});
- var rotation = principalAxes(go);
+ var rotation = viewPoint.principalAxes(go);
viewer.setRotation(rotation)
}
@@ -138,3 +144,48 @@ function byChain() {
function polymerase() {
load('4UBB');
};
+
+$(document).foundation();
+$('#1r6a').click(transferase);
+$('#1crn').click(crambin);
+$('#1ake').click(kinase);
+$('#4ubb').click(polymerase);
+$('#4c46').click(longHelices);
+$('#2f8v').click(telethonin);
+$('#style-cartoon').click(cartoon);
+$('#style-tube').click(tube);
+$('#style-line-trace').click(lineTrace);
+$('#style-sline').click(sline);
+$('#style-trace').click(trace);
+$('#style-lines').click(lines);
+$('#style-balls-and-sticks').click(ballsAndSticks);
+$('#style-spheres').click(spheres);
+$('#color-uniform').click(uniform);
+$('#color-element').click(byElement);
+$('#color-chain').click(byChain);
+$('#color-ss-succ').click(ssSuccession);
+$('#color-ss').click(ss);
+$('#color-rainbow').click(rainbow);
+$('#load-from-pdb').change(function() {
+ var pdbId = this.value;
+ this.value = '';
+ this.blur();
+ $.ajax('http://pdb.org/pdb/files/'+pdbId+'.pdb')
+ .done(function(data) {
+ structure = io.pdb(data);
+ cartoon();
+ viewer.autoZoom();
+ })
+});
+var viewer = pv.Viewer(document.getElementById('viewer'), {
+ width : 'auto', height: 'auto', antialias : true,
+ outline : true, quality : 'medium',
+ background : '#333'
+});
+viewer.addListener('viewerReady', longHelices);
+
+window.addEventListener('resize', function() {
+ viewer.fitParent();
+});
+
+});
diff --git a/index.html b/index.html
index e24e9f1..423f2d8 100644
--- a/index.html
+++ b/index.html
@@ -7,32 +7,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+