Changeset 1387 for libcaca/trunk/src
 Timestamp:
 Nov 13, 2006, 2:34:06 PM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

libcaca/trunk/src/cacademo.c
r1386 r1387 307 307 308 308 red[i] = (1.0 + sin(z + r[1] * frame)) / 2 * 0xfff; 309 blue[i] = (1.0 + cos(z + r[0] * frame)) / 2 * 0xfff;310 green[i] = (1.0 + cos(z + r[2] * frame)) / 2 * 0xfff;309 blue[i] = (1.0 + cos(z + r[0] * (frame + 100))) / 2 * 0xfff; 310 green[i] = (1.0 + cos(z + r[2] * (frame + 200))) / 2 * 0xfff; 311 311 } 312 312 … … 379 379 static float i = 10.0, j = 17.0, k = 11.0; 380 380 static double offset[360 + 80]; 381 static unsigned int angleoff; 381 382 382 383 int n, angle; … … 400 401 dk[n] = (float)cucul_rand(500, 4000) / 6000.0; 401 402 } 403 404 angleoff = cucul_rand(0, 360); 402 405 403 406 for(n = 0; n < 360 + 80; n++) … … 414 417 415 418 case UPDATE: 416 angle = frame% 360;419 angle = (frame + angleoff) % 360; 417 420 418 421 /* Crop the palette */ … … 522 525 static cucul_dither_t *dither; 523 526 static uint8_t *screen; 527 static float d[6]; 524 528 static unsigned int red[256], green[256], blue[256], alpha[256]; 525 529 … … 533 537 red[i] = green[i] = blue[i] = alpha[i] = 0; 534 538 539 for(i = 0; i < 6; i++) 540 d[i] = ((float)cucul_rand(50, 70)) / 1000.0; 541 535 542 red[0] = green[0] = blue[0] = 0x777; 536 543 red[1] = green[1] = blue[1] = 0xfff; … … 543 550 for(t = 0, dx = 0, dy = i; dx <= dy; dx++) 544 551 { 545 draw_line(dx / 3, 546 draw_line(dy / 3, 552 draw_line(dx / 3, dy / 3, (i / DISCTHICKNESS) % 2); 553 draw_line(dy / 3, dx / 3, (i / DISCTHICKNESS) % 2); 547 554 548 555 t += t > 0 ? dx  dy : dx; … … 561 568 562 569 /* Set the palette */ 563 red[0] = 0.5 * (1 + sin( 0.05 * frame)) * 0xfff;564 green[0] = 0.5 * (1 + cos( 0.07* frame)) * 0xfff;565 blue[0] = 0.5 * (1 + cos( 0.06 * frame)) * 0xfff;566 567 red[1] = 0.5 * (1 + sin( 0.07 * frame + 5.0)) * 0xfff;568 green[1] = 0.5 * (1 + cos( 0.06* frame + 5.0)) * 0xfff;569 blue[1] = 0.5 * (1 + cos( 0.05 * frame + 5.0)) * 0xfff;570 red[0] = 0.5 * (1 + sin(d[0] * (frame + 1000))) * 0xfff; 571 green[0] = 0.5 * (1 + cos(d[1] * frame)) * 0xfff; 572 blue[0] = 0.5 * (1 + cos(d[2] * (frame + 3000))) * 0xfff; 573 574 red[1] = 0.5 * (1 + sin(d[3] * (frame + 2000))) * 0xfff; 575 green[1] = 0.5 * (1 + cos(d[4] * frame + 5.0)) * 0xfff; 576 blue[1] = 0.5 * (1 + cos(d[5] * (frame + 4000))) * 0xfff; 570 577 571 578 cucul_set_dither_palette(dither, red, green, blue, alpha); 572 579 573 580 /* Draw circles */ 574 x = cos( 0.07 * frame + 5.0) * 128.0 + (XSIZ / 2);581 x = cos(d[0] * (frame + 1000)) * 128.0 + (XSIZ / 2); 575 582 y = sin(0.11 * frame) * 128.0 + (YSIZ / 2); 576 583 put_disc(screen, x, y); 577 584 578 585 x = cos(0.13 * frame + 2.0) * 64.0 + (XSIZ / 2); 579 y = sin( 0.09 * frame + 1.0) * 64.0 + (YSIZ / 2);586 y = sin(d[1] * (frame + 2000)) * 64.0 + (YSIZ / 2); 580 587 put_disc(screen, x, y); 581 588 break;
Note: See TracChangeset
for help on using the changeset viewer.