logo change color on bounce
This commit is contained in:
parent
e0b15dc9e4
commit
489a444f8e
18
u02/main.c
18
u02/main.c
|
@ -9,7 +9,7 @@ GLuint program;
|
|||
GLuint vao;
|
||||
|
||||
GLfloat hue = 0.0f;
|
||||
GLfloat hueshift = 0.1f;
|
||||
GLfloat hueshift = 32.7f;
|
||||
|
||||
GLfloat offsetX = -0.75f;
|
||||
GLfloat offsetY = 0.4f;
|
||||
|
@ -207,15 +207,19 @@ void draw(void) {
|
|||
glUseProgram(program);
|
||||
glBindVertexArray(vao);
|
||||
|
||||
hue += hueshift;
|
||||
if (hue > 360) hue -= 360;
|
||||
|
||||
|
||||
offsetX += speedX;
|
||||
offsetY += speedY;
|
||||
|
||||
if (offsetX >= 0.75f || offsetX <= -0.75f) speedX *= -1;
|
||||
if (offsetY >= 0.4f || offsetY <=-0.15f) speedY *= -1;
|
||||
if (offsetX >= 0.75f || offsetX <= -0.75f) {
|
||||
speedX *= -1;
|
||||
hue += hueshift;
|
||||
}
|
||||
|
||||
if (offsetY >= 0.4f || offsetY <=-0.15f) {
|
||||
speedY *= -1;
|
||||
hue += hueshift;
|
||||
}
|
||||
if (hue > 360) hue -= 360;
|
||||
|
||||
GLfloat r;
|
||||
GLfloat g;
|
||||
|
|
Loading…
Reference in New Issue