in website/assets/header.js [98:151]
SineWaveGenerator.prototype.drawSine = function(time, options) {
options = options || {};
amplitude = options.amplitude || this.amplitude;
wavelength = options.wavelength || this.wavelength;
lineWidth = options.lineWidth || this.lineWidth;
strokeStyle = options.strokeStyle || this.strokeStyle;
segmentLength = options.segmentLength || this.segmentLength;
var x = time;
var y = 0;
var amp = this.amplitude;
// Center the waves
var yAxis = this.height / 2;
// Styles
this.ctx.lineWidth = lineWidth * this.dpr;
this.ctx.strokeStyle = strokeStyle;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.beginPath();
// Starting Line
this.ctx.moveTo(0, yAxis);
this.ctx.lineTo(this.waveLeft, yAxis);
for (var i = 0; i < this.waveWidth; i += segmentLength) {
x = (time * this.speed) + (-yAxis + i) / wavelength;
y = Math.sin(x);
// Easing
amp = this.ease(i / this.waveWidth, amplitude);
this.ctx.lineTo(i + this.waveLeft, amp * y + yAxis);
amp = void 0;
}
// Ending Line
this.ctx.lineTo(this.width, yAxis);
// Stroke it
this.ctx.stroke();
// Clean up
options = void 0;
amplitude = void 0;
wavelength = void 0;
lineWidth = void 0;
strokeStyle = void 0;
segmentLength = void 0;
x = void 0;
y = void 0;
}