Well I don't quite understand the theory behind how the rotation works. I can however modify bits to make it faster or slower. I know enough to make it do what I want, but don't understand why it works.
Anyway I thought I would randomize the colours. Now I run into a couple of problems here.
First of all the randomizing works, but much to fast.
I had a bit of fun with scope LOL. For a start I initialized r,g,b inside an if statement, and instantly found it wouldn't work outside of the if statement, and then so I had to take it outside the if statement for scope to work.
Anyway I got it to work. Now over a period of time the colours change. Next I would like the colours to slowly transcend from one colour to the next. So I am thinking that once the random number is picked, instead of instantly changing it should change slower. That is my next goal.
Of course this code will only work in time correctly on my computer. Also I have upped the rotation speed to some crazy speed to give a cool effect.
Also later I think this random colour generator should be made a function which returns the values of r,g,b and I think that would make my code cleaner, and also I can re-use this function in other parts of my code. Actually it might be better to make it a class and then I can incorporate all the timing information in the class itself. I am probably trying to run before I can walk heh heh.
I tried to send the zip file, but for some reason even though I only changed a few lines it is 17mb and the file limit here is 10mb.
Here is my code so far
Code: Select all
if (colchange>100)
{
r=(rand() % 255);
g=(rand() % 255);
b=(rand() % 255);
colchange=0;
}
colchange++;
Draw( rotationAngle,400,250,r,g,b );