-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
31 lines (30 loc) · 1008 Bytes
/
script.js
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
var randomralks;
var statsCallback = function (maxHeight, cycle) {
$('#height').html(maxHeight);
$('#cycle').html(cycle);
}
$(function(){
$('#bt_init').click(function(e){
var iniHeight = parseInt($('#ini_height').val());
var iniPoints = parseInt($('#ini_points').val());
randomwalks = new RandomWalks(document.getElementById('myCanvas'), iniHeight, iniPoints, {
stats: statsCallback
});
randomwalks.init();
$('#myCanvas').click(function(e){
randomwalks.addPoint(e.offsetX,e.offsetY);
});
$('#myCanvas').mousemove(function(e){
$('#watch').html(randomwalks.getPointValue(e.offsetX,e.offsetY));
});
$('#bt_start').click(function(){
randomwalks.start();
});
$('#bt_stop').click(function(){
randomwalks.stop();
});
$('#bt_save').click(function(){
document.location.href = randomwalks.save();
});
});
});