Feeling a bit lost here, but I need some assistance with a simple task.
I'm trying to adjust the speed of a sine wave from 2 to 10 when a button is clicked. It seems like a small change, but for some reason, I can't quite figure it out.
If you'd like to take a look at the SineWave.js file on Github, you can find it here: Sinewave.js
Here's the code snippet:
var waves = new SineWaves({
el: document.getElementById('waves'),
speed: 2,
ease: 'SineInOut',
wavesWidth: '75%',
waves: [
{
timeModifier: 4,
lineWidth: 1,
amplitude: -25,
wavelength: 25
},
{
timeModifier: 2,
lineWidth: 1,
amplitude: -10,
wavelength: 30
},
{
timeModifier: 1,
lineWidth: 1,
amplitude: -30,
wavelength: 30
},
{
timeModifier: 3,
lineWidth: 1,
amplitude: 40,
wavelength: 40
},
{
timeModifier: 0.5,
lineWidth: 1,
amplitude: -60,
wavelength: 60
},
{
timeModifier: 1.3,
lineWidth: 1,
amplitude: -40,
wavelength: 40
}
],
resizeEvent: function() {
var gradient = this.ctx.createLinearGradient(0, 0, this.width, 0);
gradient.addColorStop(0,"rgba(25, 255, 255, 0)");
gradient.addColorStop(0.5,"rgba(255, 25, 255, 0.75)");
gradient.addColorStop(1,"rgba(255, 255, 25, 0");
var index = -1;
var length = this.waves.length;
while(++index < length){
this.waves[index].strokeStyle = gradient;
}
index = void 0;
length = void 0;
gradient = void 0;
}
});
You can also check out a Codepen example showcasing this code here:
https://codepen.io/anon/pen/GxEKJZ?editors=1010
I would greatly appreciate any help in solving this dilemma, as it's been driving me crazy...