123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- $(function() {
- var c = document.getElementById('canv');
- var $canv = c.getContext('2d');
- var w = c.width = window.innerWidth;
- var h = c.height = window.innerHeight;
- var draw = function(a, b, t) {
- $canv.lineWidth = 0.8;
- // $canv.fillStyle = 'white';
- $canv.fillStyle = 'rgba(255, 255, 255, 1)';
- $canv.fillRect(0, 0, w, h);
- for (var i = -60; i < 60; i += 1) {
- // $canv.strokeStyle = 'hsla(277, 95%, 15%, .15)';
- $canv.strokeStyle = 'hsla(207, 73%, 44%, .15)';
- $canv.beginPath();
- $canv.moveTo(0, h / 2);
- for (var j = 0; j < w; j += 10) {
- $canv.lineTo(10 * Math.sin(i / 10) +
- j + 0.008 * j * j,
- Math.floor(h / 2 + j / 2 *
- Math.sin(j / 50 - t / 50 - i / 118) +
- (i * 0.9) * Math.sin(j / 25 - (i + t) / 65)));
- };
- $canv.stroke();
- }
- }
- var t = 0;
- window.addEventListener('resize', function() {
- c.width = w = window.innerWidth;
- c.height = h = window.innerHeight;
- $canv.fillStyle = 'hsla(207, 95%, 55%, 1)';
- }, false);
- var run = function() {
- window.requestAnimationFrame(run);
- t += 1;
- draw(33, 52 * Math.sin(t / 2400), t);
- };
- run();
- })
|