示例#1
0
uint8_t tick() {

	v1 += 3;
	v2 += 5;

	int rx = (cosi(v1 >> 2) >> 5) + 2;
	int ry = (sini(v2 >> 2) >> 5) + 2;

	int x, y;
	for(y = 0; y < LED_HEIGHT; y++) {
		for(x = 0; x < LED_WIDTH; x++) {

			int dx = x - rx;
			int dy = y - ry;
			int d = sqrti(dx * dx + dy * dy);

			int q = (	(sini(x * 8 + (v1)) +
						sini(y * 8 + (v2)) +
						sini(d << 5)) >> 2) + 128;

			int a = (q * 0xffff / 0x10000) >> 6;
			setLedXY(x, y, a);
		}
	}
	return 0;
	
}
示例#2
0
static uint8_t tick(void) {

	
	uint16_t x;

	uint16_t sin1 = sini(a);
		
	uint16_t y_part =  sini(sin1);


	for(x = 0; x < LED_WIDTH; x++) 
	{
		uint16_t h = sini(x*20)+ y_part;

		uint8_t r = sini((h>>2)+a*30)>>8;
		uint8_t g = sini((h>>2)+a*40)>>8;
		uint8_t b = sini((h>>2)+a*50)>>8;

		if(r < FIRST_ON)
			r = FIRST_ON;
		if(g < FIRST_ON)
			g = FIRST_ON;
		if(b < FIRST_ON)
			b = FIRST_ON;

		setLedX(x,r,g,b);
	}
	a+=1;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#3
0
static uint8_t tick(void) {

	
	float x0 = sini(a*4)/2730.0f;
	float y0 = sini((a*8)+0x1000)/2730.0f;
	float x1 = sini(a*6)/2730.0f;
	float y1 = sini((a*3)+0x1000)/2730.0f;
	uint8_t x, y;

	for(y = 0; y < LED_HEIGHT; y++) 
	{
		for(x = 0; x < LED_WIDTH; x++) 
		{
			int dist = sini(pythagorasf(x0-x,y0-y)*2048)>>3 ;
			int dist2 = sini(pythagorasf(x1-x,y1-y)*2048)>>3 ;
			setLedXY(
				x,y,
				sini(dist+dist2+(a*20))>>8,
				sini(dist+dist2+(a*25))>>8,
				sini(dist+dist2+(a*29))>>8
			);
		}
	}
	a+=chan[0];
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#4
0
static uint8_t tick(void) {
    static uint16_t a = 0;

    uint8_t x, y;

    uint8_t sin1 = sini(a+512);
    uint8_t sin2 = sini(a*2);
    uint16_t sin3 = sini(a*3)<<8;

    for(y = 0; y < LED_HEIGHT; y++)
    {
        uint16_t y_part = h = 128*sini(sin2+y*20)  + sin3;

        for(x = 0; x < LED_WIDTH; x++)
        {
            h = 128*sini(sin1+x*30)+ y_part;
            hsv_to_rgb();
            setLedXY(x, y, nr>>2,ng>>2,nb>>2);
        }
    }
    a++;
    if(a==1024)
    {
        a=0;
    }
    return 0;
}
示例#5
0
static uint8_t tick(void) {

	
	float x0 = (float)sini(a*60)/(0xffff/(LED_WIDTH+1))-1;
	float x1 = (float)sini(a*45)/(0xffff/(LED_WIDTH+1))-1;
	float x2 = (float)sini(a*150)/(0xffff/(LED_WIDTH+1))-1;



	for(int x = 0; x < LED_WIDTH; x++) 
	{

		uint8_t red = 0;
		uint8_t green = 0;
		uint8_t blue = 0;

		float diff0 = fabsf(x0-x);
		float diff1 = fabsf(x1-x);
		float diff2 = fabsf(x2-x);
	

		if(diff0 < 1.5f)
		{
			//red = (1.5f-diff0)*170;
		}
		if(diff1 < 1.5f)
		{
			//green = (1.5f-diff1)*170;
		}
		if(diff2 < 2)
		{
			blue= (2-diff2)*127;
		}

		setLedX(
			x,
			red,
			green,
			blue
		);
	}
	a+=1;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#6
0
static uint8_t tick(void) {

	
	float x0 = (float)sini(a*40)/(0xffff/(LED_WIDTH+20))-10;
	float x1 = (float)sini(a*70)/(0xffff/(LED_WIDTH+20))-10;
	float x2 = (float)sini(a*103)/(0xffff/(LED_WIDTH+20))-10;

	for(int x = 0; x < LED_WIDTH; x++) 
	{

		uint8_t red = 0;
		uint8_t green = 0;
		uint8_t blue = 0;

		uint16_t diff0 = fabsf(x0-x);
		uint16_t diff1 = fabsf(x1-x);
		uint16_t diff2 = fabsf(x2-x);

		if(diff0 < 8)
		{
			red = item[diff0];
		}
		if(diff1 < 8)
		{
			green= item[diff1];
		}
		if(diff2 < 8)
		{
			blue = item[diff2];
		}

		setLedX(
			x,
			red,
			green,
			blue
		);
	}
	a+=1;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#7
0
static uint8_t tick(void) {

	
	uint8_t x;

	uint16_t sin1 = sini(a);
		
	uint16_t y_part =  sini(sin1)/65535.0f*180.0f;


	for(x = 0; x < LED_WIDTH; x++) 
	{
		h = (sini(x*580)/65535.0f*180.0f)+ y_part;


		struct hsv_colour hsv;
		struct rgb_colour rgb;

		hsv.h = h/360.0f;
		hsv.s = 1;
		hsv.v = 1;

		hsv2rgb( &hsv, &rgb );

		float norm = sqrtf(rgb.r*rgb.r + rgb.b*rgb.b + rgb.g*rgb.g);
		rgb.r /= norm;
		rgb.g /= norm;
		rgb.b /= norm;   

		setLedX(x,rgb.r*255,rgb.g*255,rgb.b*255);

	}
	a+=10;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#8
0
static uint8_t tick(void) {

	
	uint8_t x, y;

	uint16_t sin1 = sini(a);
	float x0 = (float)sini(a*8)/256-64;
	float y0 = (float)sini((a*9)+0x1000)/256-64;
	float x1 = (float)sini(a*12)/128-128;
	float y1 = (float)sini((a*13)+0x1000)/128-128;
	
		
	for(y = 0; y < LED_HEIGHT; y++) 
	{
		uint16_t y_part =  sini(sin1+y*512);


		for(x = 0; x < LED_WIDTH; x++) 
		{
			
			float dist = pythagorasf(x0-x,y0-y);
			float dist2 = pythagorasf(y1-x,x1-y);


			uint16_t h = sini(sin1+x*512)+ y_part;
			h += sini(dist*500);
			h += sini(dist2*300);
			//uint16_t h = sini(sin1+x*600)+ y_part + sini(dist*500) + sini(dist2*300);
			setLedXY(
				x,y,
				h>>12
			);
		}
	}
	a+=1;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#9
0
static uint8_t tick(void) {

	
	uint16_t x;

	uint16_t sin1 = sini(a);
	float x0 = (float)sini(a*6)/256-64;
	float y0 = (float)sini((a*6)+0x1000)/256-64;
	float x1 = (float)sini(a*12)/128-128;
	float y1 = (float)sini((a*12)+0x1000)/128-128;
	
		
	uint16_t y_part =  sini(sin1);


	for(x = 0; x < LED_WIDTH; x++) 
	{
		
		float dist = pythagorasf(x0-x,y0);
		float dist2 = pythagorasf(y1-x,x1);


		uint16_t h = sini(sin1+x*12)+ y_part;
		h += sini(dist*200);
		h += sini(dist2*150);
		//uint16_t h = sini(sin1+x*600)+ y_part + sini(dist*500) + sini(dist2*300);
		setLedX(
			x,
			sini((h>>2)+a*200)>>8,
			sini((h>>2)+a*240)>>8,
			sini((h>>2)+a*280)>>8
		);
	}
	a+=1;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#10
0
static uint8_t tick(void) {

	
	uint16_t x, y;

	uint16_t sin1 = sini(a);
	float x0 = (float)sini(a*4)/256-64;
	float y0 = (float)sini((a*4)+0x1000)/256-64;
	float x1 = (float)sini(a*5)/128-128;
	float y1 = (float)sini((a*5)+0x1000)/128-128;
		
	y = 0;
	{
		uint16_t y_part =  sini(sin1+y*2);


		for(x = 0; x < LED_WIDTH; x++) 
		{
			
			float dist = pythagorasf(x0-x,y0-y);
			float dist2 = pythagorasf(y1-x,x1-y);

			uint16_t h = sini(sin1+x*200)+ y_part + sini(dist*120) + sini(dist2*100);
			
			setLedX(
				x,
				sini((h>>2)+a*500)>>8,0,0
			);
		}
	}
	a+=1;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}
示例#11
0
static int16_t cosi(uint8_t x) { return sini(x + 32); }
returntype tani(unsigned int x){
    return (sini(x)/cosi(x));
}
示例#13
0
static uint8_t tick(void) {

	
	uint8_t x, y;

	uint16_t sin1 = sini(a);
	float x0 = (float)sini(a*4)/256-64;
	float y0 = (float)sini((a*4)+0x1000)/256-64;
	float x1 = (float)sini(a*5)/128-128;
	float y1 = (float)sini((a*5)+0x1000)/128-128;
		
		
	uint8_t joy_x = 128;
	uint8_t joy_y = 128;

	get_stick(&joy_x,&joy_y);
		
	for(y = 0; y < LED_HEIGHT; y++) 
	{
		uint16_t y_part =  sini(sin1+y*20);


		for(x = 0; x < LED_WIDTH; x++) 
		{
			
			float dist = pythagorasf(x0-x,y0-y);
			float dist2 = pythagorasf(y1-x,x1-y);


			uint16_t h = sini(sin1+x*20)+ y_part + sini(dist*500) + sini(dist2*joy_y*2);
			uint16_t h2 = sini(sin1+x*30)+ y_part + sini(dist*joy_x*2) + sini(dist2*350);
			setLedXY(
				x,y,
				sini((h>>2)+a*500)>>8,
				sini((h2>>2)+a*320+0x1555)>>8,
				sini((h>>2)+a*630+0x2aaa)>>8
			);
		}
	}
	char* nick = "";
	uint16_t text_width = get_text_width_16pt(nick);
	draw_text_inv_16pt((LED_WIDTH/2)-(text_width/2),LED_HEIGHT/2-11, nick);
	a+=1;
	if(a==0x4000)
	{
		a=0;
	}
	return 0;
}