The methods
Sin() en
Cos() allow you to retrieve the sine and cosine from any
value. This is most fun when that value is the current time. The result over time is a
value which moves smoothly between -1 and 1.
float x = Sin(Time.curTime());
float y = Cos(Time.curTime());
- The code above illustrates how to use the sine and cosine with the current
time. Create an application which shows a line, starting from the middle
of the screen towards the current value of sine and cosine for the x and y
value of the ending.
- Change the width of the line.
- Make the line move at double speed.
- Decrease the length of the line.
- (This will be a bit harder) Try to create an analog watch.