Method to change a variable smoothly over time in JavaScript?
Is it possible to change a variable continuously over time? For example if a var is initialized: let x = 0; how can I have that smoothly change to a value of something like 10 over a period of time, lets say 10 seconds. Ideally I'd like to be able to use something like a sine where the frequency could be controlled. For example, a sine at a frequency of .1 Hz would take 10 seconds to complete a cycle. I'd gladly settle for any method, but being a musician I thought that maybe an oscillator would be one option as that would allow different waveforms (sine, saw, square, triangle) to control the value of the variable. But again, any method to smoothly control the variable is fine with me. I attached a simple oscillator as an example but have no idea whether the output of an AudioContext oscillator could be converted into a variable value. https://code.sololearn.com/Wj83O6Zt7lIz/?ref=app