Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update anim speed

  • Loading branch information...
commit 865210a35ea98d2cf9270b55a6b344b1df286211 1 parent b512f56
@neophob authored
View
15 processingApp/kalikut/GeneratorAnimation.pde
@@ -9,14 +9,16 @@ private static final int GEN_ANIM_FUNNY = 6;
private static final int GEN_ANIM_HOTEL = 7;
private static final int GEN_ANIM_KNIGHTRIDER = 8;
private static final int GEN_ANIM_FLIPPER = 9;
+private static final int GEN_ANIM_FADER = 10;
-private static final int MAX_ANIMATION = 9;
+private static final int MAX_ANIMATION = 10;
private List<Integer[]> funnyWords;
private int selectedRandomChar = 0;
private int selectedRandomWord = 0;
private int krDirection = 0;
private int krPos = 0;
+private int hotelRandom;
void generateAnimation() {
@@ -25,13 +27,13 @@ void generateAnimation() {
return;
}
- if (frame%10==1) {
+ if (frame%globalDelay==1) {
selectedRandomChar = int(random(STR_KALIKUT.length()));
selectedRandomWord = int(random(funnyWords.size()));
+ hotelRandom=int(random(25));
}
- int hotelRandom=int(random(25));
-
+ int fadrCol = color((frame<<4)%256, (frame<<4)%256, (frame<<4)%256);
for (int x=0; x<NR_OF_PIXELS_X; x++) {
for (int y=0; y<NR_OF_PIXELS_Y; y++) {
@@ -98,7 +100,10 @@ void generateAnimation() {
if ((frame-i>>2)%2==1) {
colorArray[i] = color(0, 0, 0);
}
+ break;
+ case GEN_ANIM_FADER:
+ colorArray[i] = blendColor(fadrCol, 0xff000000 | colorArray[i], MULTIPLY);
break;
}
}
@@ -114,7 +119,7 @@ void generateAnimation() {
break;
case GEN_ANIM_KNIGHTRIDER:
- if (frame%5==1) {
+ if (frame%globalDelay==1) {
if (krDirection == 0) {
krPos++;
if (krPos == 7) {
View
58 processingApp/kalikut/GeneratorColor.pde
@@ -8,9 +8,10 @@ private static final int GEN_COL_RGBCOL = 5;
private static final int GEN_COL_PLASMA = 6;
private static final int GEN_COL_PULSE = 7;
private static final int GEN_COL_SLIDER = 8;
-private static final int GEN_COL_XXX = 9;
+private static final int GEN_COL_GLACE = 9;
+private static final int GEN_COL_XXX = 10;
-private static final int MAX_COLOR = 9;
+private static final int MAX_COLOR = 10;
private static final int FIRE_BUFFER = 4;
@@ -25,7 +26,7 @@ void generateColor() {
updateFireBuffer();
}
- if (frame%10==1) {
+ if (frame%globalDelay==1) {
for (int x=0; x<NR_OF_PIXELS_X; x++) {
int rnd = int(random(3));
switch (rnd) {
@@ -44,20 +45,21 @@ void generateColor() {
}
}
- plasmaY+=0.1;
- int a=0;
+ int globalDelayLocal = globalDelay/2;
+ float globalDelayPlasma = globalDelay/400.0f;
+ plasmaY+=globalDelayPlasma;
+
for (int x=0; x<NR_OF_PIXELS_X; x++) {
for (int y=0; y<NR_OF_PIXELS_Y; y++) {
int i = y*NR_OF_PIXELS_X+x;
switch(genColor) {
case GEN_COL_RAINBOW: //Rainbow
- colorArray[i] = Wheel(frame-a*8);
- a+=1;
+ colorArray[i] = Wheel((frame+x+y)*globalDelayLocal);
break;
case GEN_COL_RAINBOW_SOLID: //Rainbow Solid
- colorArray[i] = Wheel(frame*2);
+ colorArray[i] = Wheel(frame*globalDelayLocal);
break;
case GEN_COL_SOLID: //Solid
@@ -75,21 +77,21 @@ void generateColor() {
case GEN_COL_PLASMA:
float ypi = y*PI;
- float xpi = x*PI/8f;
+ float xpi = x*PI/globalDelayLocal;
int c=int(sin(ypi+plasmaY)*16+sin(ypi*1.5f+PI/6+plasmaY)*16+cos(xpi+plasmaX)*16+cos(xpi*2f+PI/2+plasmaX)*25)+32;
c=constrain(c, 0, 99);
colorArray[i]=plasma[c];
- plasmaX+=0.01;
+ plasmaX+=globalDelayPlasma;
break;
case GEN_COL_PULSE:
int ofs = i+frame;
- int xorR = (frame<<4)%256;
+ int xorR = (frame*globalDelayLocal)%256;
int xorB = (frame*i)%256;
int xorG = 255-xorR;
colorArray[i]=color(xorR, xorG, xorB);
break;
-
+
case GEN_COL_SLIDER:
ofs = i+frame;
xorR = ((i*ofs))%256;
@@ -97,26 +99,26 @@ void generateColor() {
xorG = (xorR+xorB)>>1;
colorArray[i]=color(xorR, xorG, xorB);
break;
-
- case GEN_COL_XXX:
+
+ case GEN_COL_GLACE:
if (y>0) {
- colorArray[i] = WheelInv(frame-a*8);
- } else {
- colorArray[i] = Wheel(frame-a*8);
+ colorArray[i] = WheelInv((frame+x+y)*globalDelayLocal);
+ }
+ else {
+ colorArray[i] = Wheel((frame+x+y)*globalDelayLocal);
}
- a+=1;
-
-// ofs = i+frame;
-// xorG=xorB=xorR = (frame<<4)%256;
+ break;
- // int xorR = ((frame*frame)>>4)%256;
- // int xorG = (frame*i)%256;
- // int xorB = ((i*ofs)^ofs)%256;
+ case GEN_COL_XXX:
+ ofs = i+frame;
+ xorR = ((frame*frame)>>4)%256;
+ xorG = (frame*i)%256;
+ xorB = ((i*ofs)^ofs)%256;
// int xorR = ((i*frame)^ofs)%256;
// int xorG = (ofs^i)%256;
// int xorB = (ofs^frame)%256;
-// colorArray[i]=color(xorR, xorG, xorB);
+ colorArray[i]=color(xorR, xorG, xorB);
break;
}
}
@@ -168,13 +170,13 @@ void setupColor() {
//fire fx
void updateFireBuffer() {
int ofs;
-
+ int localRnd = globalDelay;
//seed
for (int y=0; y<NR_OF_PIXELS_Y; y++) {
ofs = y*(NR_OF_PIXELS_X+FIRE_BUFFER);
- int rnd = int(random(16));
+ int rnd = int(random(globalDelay));
/* the lower the value, the intense the fire, compensate a lower value with a higher decay value*/
- if (rnd > 8) {
+ if (rnd > globalDelay/2) {
fireBuffer[ofs] = 255;
}
else {
View
17 processingApp/kalikut/Gui.pde
@@ -20,8 +20,9 @@ void initGui() {
.addItem("Plasma", GEN_COL_PLASMA)
.addItem("Pulse", GEN_COL_PULSE)
.addItem("Slider", GEN_COL_SLIDER)
- .addItem("Test", GEN_COL_XXX)
- .activate(0);
+ .addItem("Glace", GEN_COL_GLACE)
+ .addItem("Test", GEN_COL_XXX)
+ .activate(0);
animationButton = cp5.addRadioButton("animationButton")
.setPosition(20, 260)
@@ -40,8 +41,9 @@ void initGui() {
.addItem("Funny", GEN_ANIM_FUNNY)
.addItem("Hotel", GEN_ANIM_HOTEL)
.addItem("KnightRider", GEN_ANIM_KNIGHTRIDER)
- .addItem("Flipper", GEN_ANIM_FLIPPER)
- .activate(0);
+ .addItem("Flipper", GEN_ANIM_FLIPPER)
+ .addItem("Fader", GEN_ANIM_FADER)
+ .activate(0);
soundButton = cp5.addRadioButton("soundButton")
.setPosition(20, 320)
@@ -177,9 +179,8 @@ void controlEvent(ControlEvent theEvent) {
}
if (theEvent.isFrom(fpsSlider)) {
- int fps = 5+int(55*fpsSlider.getValue());
- //println("framerate: "+fps);
- frameRate(fps);
+ globalDelay = 2+int(18*fpsSlider.getValue());
+ println("framerate: "+globalDelay);
}
if (theEvent.isFrom(allColorSlider)) {
@@ -198,6 +199,7 @@ void controlEvent(ControlEvent theEvent) {
}
}
+//draw some rectangles
void drawBackgroundSlide(int ypos, int ysize) {
this.loadPixels();
int col = color(48, 48, 48);
@@ -212,6 +214,7 @@ void drawBackgroundSlide(int ypos, int ysize) {
this.updatePixels();
}
+//draw background
void drawGradientBackground() {
this.loadPixels();
int ofs=this.width*(this.height-255);
View
5 processingApp/kalikut/kalikut.pde
@@ -28,6 +28,7 @@ private ColorPicker cp;
private Slider fpsSlider, allColorSlider, soundSensitive;
private Textarea myTextarea;
private CheckBox checkbox;
+private int globalDelay = 10;
//internal fx
private int genAnim = GEN_ANIM_NOTHING, genColor = GEN_COL_RAINBOW, genSnd = GEN_SND_NOTHING;
@@ -106,10 +107,6 @@ void draw() {
frame++;
}
-
-
//COL: florida, gelb + rosa
-
//FX: Voll da, voll weg, snake, stobo halb unten und oben
-//SND: bei beat oder volume, nachdem voll detection war, langsam rausfaden
Please sign in to comment.
Something went wrong with that request. Please try again.