ein paar minimalistische animationen

This commit is contained in:
Martin Herweg 2009-02-25 23:49:59 +00:00
parent c2f14a7171
commit 4c309b4274
5 changed files with 139 additions and 78 deletions

View File

@ -94,12 +94,12 @@ void test_palette2(){
} }
void test_lines(){ void checkbox(){
unsigned char n,x, delay=250; unsigned char x, delay=250;
// checkbox // quadrat aus linien
line((pixel){0,0}, (pixel){7,0} ,3); line((pixel){0,0}, (pixel){7,0} ,3);
wait(delay); wait(delay);
line((pixel){7,0}, (pixel){7,7} ,3); line((pixel){7,0}, (pixel){7,7} ,3);
@ -109,7 +109,7 @@ line((pixel){7,7}, (pixel){0,7} ,3);
line((pixel){0,7}, (pixel){0,0} ,3); line((pixel){0,7}, (pixel){0,0} ,3);
wait(delay); wait(delay);
// diagonal // 2 diagonale lininen
line((pixel){7,7}, (pixel){0,0} ,3); line((pixel){7,7}, (pixel){0,0} ,3);
wait(delay); wait(delay);
line((pixel){0,7}, (pixel){7,0} ,3); line((pixel){0,7}, (pixel){7,0} ,3);
@ -123,35 +123,10 @@ wait(delay);
wait(30); wait(30);
} }
//sunrays
for (n=0;n<=NUMPLANE;n++){
line((pixel){15,0}, (pixel){NUM_COLS-1,0} ,n);
wait(delay);
line((pixel){15,0}, (pixel){7,NUM_ROWS-1} ,n);
wait(delay);
line((pixel){15,0}, (pixel){NUM_COLS-1,NUM_ROWS-1} ,n);
wait(delay);
line((pixel){15,0}, (pixel){15,NUM_ROWS-1} ,n);
wait(delay);
}
for (n=NUMPLANE;n!=255;n--){
line((pixel){15,0}, (pixel){NUM_COLS-1,0} ,n);
wait(delay);
line((pixel){15,0}, (pixel){7,NUM_ROWS-1} ,n);
wait(delay);
line((pixel){15,0}, (pixel){NUM_COLS-1,NUM_ROWS-1} ,n);
wait(delay);
line((pixel){15,0}, (pixel){15,NUM_ROWS-1} ,n);
}
wait(500);
} }
void movinglines(){ void movinglines(){
unsigned char x,y; unsigned char x,y,n;
line((pixel){NUM_COLS-1,NUM_ROWS-1}, (pixel){NUM_COLS-1,0} ,3); line((pixel){NUM_COLS-1,NUM_ROWS-1}, (pixel){NUM_COLS-1,0} ,3);
@ -170,23 +145,27 @@ void movinglines(){
} }
//eine linie von rechts nach links und //eine linie von rechts nach links und
// 8 mal von oben nach unten //1-8 mal von oben nach unten
// gleichzeitig // je nach display format
for (x=0;x<NUM_COLS-1;x++){ // das ganze 4 mal
y=x%NUM_ROWS; for (n=0;n<4;n++){
line((pixel){0,y}, (pixel){NUM_COLS-1,y} ,3); for (x=0;x<NUM_COLS-1;x++){
line((pixel){x,0}, (pixel){x,NUM_ROWS-1} ,3); y=x%NUM_ROWS;
wait(50); line((pixel){0,y}, (pixel){NUM_COLS-1,y} ,3);
line((pixel){x,0}, (pixel){x,NUM_ROWS-1} ,3);
wait(50);
line((pixel){0,y}, (pixel){NUM_COLS-1,y} ,0); line((pixel){0,y}, (pixel){NUM_COLS-1,y} ,0);
line((pixel){x,0}, (pixel){x,NUM_ROWS-1} ,0); line((pixel){x,0}, (pixel){x,NUM_ROWS-1} ,0);
//wait(10); //wait(10);
}
} }
} }
void rectangles(){ //rechteckmuster mit helligkeitsstufen
void rectangle1(){
unsigned char x,value,xcenter,ycenter,size; unsigned char x,value,xcenter,ycenter,size;
unsigned int delay=500; unsigned int delay=500;
@ -194,29 +173,7 @@ void rectangles(){
xcenter = NUM_COLS/2; xcenter = NUM_COLS/2;
ycenter = NUM_ROWS/2; ycenter = NUM_ROWS/2;
clear_screen(0); clear_screen(0);
filled_rectangle((pixel){1,1},4,2,3);
wait(delay);
wait(delay);
filled_rectangle((pixel){10,1},5,5,3);
wait(delay);
wait(delay);
// filled_rectangle((pixel){30,2},30,5,2);
// wait(delay);
// filled_rectangle((pixel){40,0},8,8,1);
// wait(delay);
filled_rectangle((pixel){1,1},4,2,2);
wait(delay);
filled_rectangle((pixel){10,1},5,5,1);
wait(delay);
for (x=0;x<NUM_ROWS;x++){
shift_pixmap_l();
wait(30);
}
size=NUM_ROWS; size=NUM_ROWS;
value=3; value=3;
@ -233,12 +190,103 @@ void rectangles(){
size-=2; size-=2;
} }
wait(delay); wait(delay);
wait(delay); wait(delay);
wait(delay); wait(delay);
}
// zufallsrechtecke
void rectangles(){
unsigned char value,n,x,y,h,w;
clear_screen(0);
for (n=0;n<60;n++){
x = RANDOM8()%NUM_COLS;
y = RANDOM8()%NUM_ROWS;
h = RANDOM8()%NUM_COLS/2;
w = RANDOM8()%NUM_ROWS/2;
value= RANDOM8()%(NUMPLANE+1);
filled_rectangle((pixel){x,y},w,h,value);
wait(500+RANDOM8()%3000);
}
}
// schräge linien die aufblitzen
void lines1(){
unsigned char value,n,x,y,h,w,i,j;
unsigned int delay=500;
clear_screen(0);
for (n=0;n<200;n++){
x = RANDOM8()%NUM_COLS;
y = RANDOM8()%NUM_ROWS;
h = RANDOM8()%NUM_COLS;
w = RANDOM8()%NUM_ROWS;
value= RANDOM8()%(NUMPLANE+1);
line((pixel){x,y},(pixel){w,h},value);
wait(RANDOM8()%delay);
line((pixel){x,y},(pixel){w,h},0);
}
}
// random dots
void dots1(){
unsigned char delay=100,n,x,y;
clear_screen(0);
for (n=0;n<50;n++){
x = RANDOM8()%NUM_COLS;
y = RANDOM8()%NUM_ROWS;
setpixel((pixel){x,y} , 1);
wait(delay);
setpixel((pixel){x,y} , 2);
wait(delay);
setpixel((pixel){x,y} , 3);
wait(delay);
setpixel((pixel){x,y} , 2);
wait(delay);
setpixel((pixel){x,y} , 1);
wait((RANDOM8()%255)*10);
}
}
// punkte, die von links nach rechts fliegen
void flydots(){
unsigned char value,y;
unsigned int n,delay=100;
clear_screen(0);
for (n=0;n<200;n++){
y = RANDOM8()%NUM_ROWS;
value= RANDOM8()%(NUMPLANE+1);
setpixel((pixel){NUM_COLS-1,y} , value);
shift_pixmap_l();
wait(delay);
}
} }
#endif #endif

View File

@ -14,8 +14,12 @@ void test_level3();
void test_levels(); void test_levels();
void test_palette(); void test_palette();
void test_palette2(); void test_palette2();
void dots1();
void flydots();
void rectangle1();
void rectangles(); void rectangles();
void test_lines(); void lines();
void checkbox();
void movinglines(); void movinglines();
void snake(); void snake();
void matrix(); void matrix();

View File

@ -117,9 +117,11 @@ void snake(){
for(j=0;j<apple_num;j++){ for(j=0;j<apple_num;j++){
if(x%2){ if(x%2){
setpixel(apples[j], 3); setpixel(apples[j], 2);
}else{ }else{
#ifdef CAN_SUPPORT
clearpixel(apples[j]); clearpixel(apples[j]);
#endif
} }
} }

View File

@ -73,13 +73,13 @@ SIGNAL(SIG_OUTPUT_COMPARE0)
switch (plane){ switch (plane){
case 0: case 0:
OCR0 = 30;
break;
case 1:
OCR0 = 60; OCR0 = 60;
break; break;
case 1:
OCR0 = 120;
break;
case 2: case 2:
OCR0 = 80; OCR0 = 160;
break; break;
// case 3: // case 3:
// OCR0 = 24; // OCR0 = 24;

View File

@ -50,10 +50,6 @@ void display_loop(){
#ifdef ANIMATION_SPIRALE #ifdef ANIMATION_SPIRALE
case 2: case 2:
movinglines();
test_lines();
rectangles();
scrolltext("d/#ABC");
spirale(5); spirale(5);
break; break;
#endif #endif
@ -72,7 +68,7 @@ void display_loop(){
#ifdef ANIMATION_SCHACHBRETT #ifdef ANIMATION_SCHACHBRETT
case 5: case 5:
//schachbrett(10); schachbrett(10);
break; break;
#endif #endif
@ -90,7 +86,7 @@ void display_loop(){
#ifdef ANIMATION_RANDOM_BRIGHT #ifdef ANIMATION_RANDOM_BRIGHT
case 8: case 8:
random_bright(200); random_bright(30);
break; break;
#endif #endif
@ -100,6 +96,17 @@ void display_loop(){
break; break;
#endif #endif
//#ifdef ANIMATION_RECTAGLES
case 10:
flydots();
lines1();
dots1();
movinglines();
checkbox();
rectangle1();
rectangles();
break;
//#endif
case 29: case 29:
// mode = 1; // mode = 1;
break; break;