We can control different aspects of the wave form when we modify the sine function with offset values. With this we can shape frequency, amplitude, shift and phase of the sine wave. In our example we used the argument time * 90 to get the desired sine. By multiplying time with 90 we have actually edited the frequency of our wave. The frequency in our example is 0.25 Hz which is one cycle in four seconds. The abstract form can be written like this:
A = frequency modifier value;
B = amplitude modifier value;
C = shift modifier value;
D = phase modifier value;
wave = sin( time * A + D ) * B + C;
We can increase the frequency when we increase the frequency modifier value:
sphere.YPosition = sin( time * 360 );
Now we will get 4 complete periods of sine waves beause it will oscillate with 1Hz - once in a second.
|