-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInit.js
More file actions
99 lines (86 loc) · 2.64 KB
/
Copy pathInit.js
File metadata and controls
99 lines (86 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
function start()
{
var container = new SimulationContainer();
var timer = null;
var playing = 0;
var ncontacts = 10;
var naxons = 5;
var ntargets = 100;
$( "#contacts" ).slider({
range: "min",
value: ncontacts,
min: 2,
max: 100,
slide: function( event, ui ) {
$( "#ncontacts" ).val( ui.value );
}
});
$( "#ncontacts" ).val( $( "#contacts" ).slider( "value" ) );
ncontacts = $( "#contacts" ).slider( "option", "value" );
$( "#axons" ).slider({
range: "min",
value: naxons,
min: 2,
max: 100,
slide: function( event, ui ) {
$( "#naxons" ).val( ui.value );
}
});
$( "#naxons" ).val( $( "#axons" ).slider( "value" ) );
naxons = $( "#axons" ).slider( "option", "value" );
$( "#targets" ).slider({
range: "min",
value: ntargets,
min: 1,
max: 1000,
slide: function( event, ui ) {
$( "#ntargets" ).val( ui.value );
}
});
$( "#ntargets" ).val( $( "#targets" ).slider( "value" ) );
ntargets = $( "#targets" ).slider( "option", "value");
$( "#initialize" ).button().click(function( event )
{
var ncontacts = $( "#contacts" ).slider( "option", "value" );
var naxons = $( "#axons" ).slider( "option", "value" ) ;
var ntargets = $( "#targets" ).slider( "option", "value" );
$( "#simulations" ).html("");
container.Initialize(ncontacts, naxons, ntargets);
container.ComputePairings();
container.DrawPairingsBackground();
container.Reset();
});
$( "#reset" ).button().click(function( event )
{
container.Reset();
});
// $( "#compute-pairings" ).button().click(function( event )
// {
// container.ComputePairings();
// container.DrawPairingsBackground();
// container.PlotPairings();
// });
$( "#play" ).button().click(function( event )
{
if(playing === 1)
{
playing = 0;
// $("#play").button('option', 'label', 'Play / ');
window.clearInterval(timer);
}
else
{
playing = 1;
timer = window.setInterval(function()
{
//$("#play").button('option', 'label', 'Play');
if(container.Animate() === 1)
{
playing = 0;
// $("#play").button('option', 'label', 'Play');
window.clearInterval(timer);
}
}, 0);
}
});
}