-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.js
42 lines (32 loc) · 1.08 KB
/
helper.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
32
33
34
35
36
37
38
39
40
41
42
var modal = document.getElementById("showInfo");
var btn = document.getElementById("btn");
var span = document.getElementsByClassName("close")[0];
window.isPlay = false;
modal.style.display="none";
btn.onclick = function() {
modal.style.display = "block"
}
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
var screenshot = document.getElementById("screenshot");
screenshot.onclick = function(event){
var aCanvas = document.getElementById("glCanvas"),
ctx = aCanvas.getContext("webgl2", {preserveDrawingBuffer: true});
;
aCanvas.toBlob( function(blob)
{
var d = new Date();
var fName = d.getFullYear()+"_"+d.getMonth()+"_"+d.getDate()+"_"+
d.getHours()+"_"+d.getMinutes()+"_"+d.getSeconds();
saveAs(blob, "bu3npattern"+fName+".png");
});
};
$('#tweet').click(function(){
postCanvasToURL();
});
}