Difference between revisions of "Template:Pitt"
m |
|||
Line 76: | Line 76: | ||
$(this).css("width", newWidth + 'px'); | $(this).css("width", newWidth + 'px'); | ||
}); | }); | ||
+ | var c = document.getElementById("bannerCanvas"); | ||
+ | c.height = $(document).height() / 10; | ||
+ | c.width = $(document).width() / 10; | ||
+ | var ctx = c.getContext('2d'); | ||
+ | ctx.fillRect(0, 0, c.width, c.height); | ||
}, | }, | ||
methods = { | methods = { | ||
Line 259: | Line 264: | ||
for(y = 0; y < c.height; y++) { | for(y = 0; y < c.height; y++) { | ||
for(x = 0; x < c.width; x++) { | for(x = 0; x < c.width; x++) { | ||
− | color = | + | color = 20 / c.width * Math.max(0, 5 * c.width - (10 * x - event.pageX) * (10 * x - event.pageX) - (10 * y - event.pageY) * (10 * y - event.pageY)); |
data[((c.width * y) + x) * 4] += color; | data[((c.width * y) + x) * 4] += color; | ||
data[((c.width * y) + x) * 4 + 1] += color; | data[((c.width * y) + x) * 4 + 1] += color; | ||
Line 268: | Line 273: | ||
}); | }); | ||
+ | |||
+ | function fader(){ | ||
+ | var c = document.getElementById("bannerCanvas"); | ||
+ | var ctx = c.getContext('2d'); | ||
+ | ctx.globalCompositeOperation = "darken"; | ||
+ | ctx.fillStyle = "rgba(0, 0, 0, 0.01)"; | ||
+ | ctx.fillRect(0, 0, c.width, c.height); | ||
+ | } | ||
+ | |||
+ | setInterval(fader, 50); | ||
}); | }); |
Revision as of 05:08, 5 June 2015