Beispiel #1
0
void AlaLed::setAnimation(int animation, long speed)
{
	if (this->animation == animation && this->speed == speed)
		return;
	
	this->animation = animation;
	this->speed = speed;

	setAnimationFunc(animation);
	animStartTime = millis();
}
Beispiel #2
0
void AlaLedRgb::setAnimation(int animation, long speed, AlaPalette palette)
{
	// is there any change?
	if (this->animation == animation && this->speed == speed && this->palette == palette)
		return;
	
	// delete any previously allocated array
	if (pxPos!=NULL)
	{ delete[] pxPos; pxPos=NULL; }
	if (pxSpeed!=NULL)
	{ delete[] pxSpeed; pxSpeed=NULL; }
	
	this->animation = animation;
	this->speed = speed;
	this->palette = palette;

	setAnimationFunc(animation);
	animStartTime = millis();
}
Beispiel #3
0
void AlaLedRgb::setAnimation(int animation, long speed, AlaColor color)
{
	// is there any change?
	if (this->animation == animation && this->speed == speed && this->palette.numColors == 1 && this->palette.colors[0] == color)
		return;
	
	// delete any previously allocated array
	if (pxPos!=NULL)
	{ delete[] pxPos; pxPos=NULL; }
	if (pxSpeed!=NULL)
	{ delete[] pxSpeed; pxSpeed=NULL; }
		
	this->animation = animation;
	this->speed = speed;
	
	this->palette.numColors = 1;
	this->palette.colors = (AlaColor*)malloc(3);
	this->palette.colors[0] = color;
	
	setAnimationFunc(animation);
	animStartTime = millis();
}