-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tint.js
40 lines (36 loc) · 866 Bytes
/
Tint.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
//Canvas
var canvas = document.getElementById('draw');
var ctx = canvas.getContext('2d');
var n = 0, m = 0;
function timedTint() {
ctx.fillStyle="rgba(200,200,200,0.01)";
ctx.globalCompositeOperation = 'source-over';
ctx.beginPath();
ctx.rect(0,0,canvas.width,canvas.height);
ctx.fill();
ctx.beginPath();
if(dragging || m++>160){
return;
}
setTimeout("timedTint()",40);
}
function singleTint(){
ctx.fillStyle="rgba(200,200,200,0.005)";
ctx.globalCompositeOperation = 'source-over';
ctx.beginPath();
ctx.rect(0,0,canvas.width,canvas.height);
ctx.fill();
ctx.beginPath();
}
function quickTint(){
ctx.fillStyle="rgba(200,200,200,0.01)";
ctx.globalCompositeOperation = 'source-over';
ctx.beginPath();
ctx.rect(0,0,canvas.width,canvas.height);
ctx.fill();
ctx.beginPath();
if(n++>200){
return;
}
setTimeout("quickTint()",10);
}