 Animation *lastAnim;
 fract8 animTransition;
 
+#define TIME_CYCLE 20000
+#define TIME_PAUSED ((unsigned long)-1)
+unsigned long nextAnimationTime = 0;
+int state = -1; // Start state
+
+void NextAnimation(int pin)
+{
+  state = leaveState(state);
+  Serial.print("next animation state: ");
+  Serial.println(state);
+}
+
+void Pause(int pin)
+{
+  if (nextAnimationTime == TIME_PAUSED) {
+    Serial.println("unpause");
+    nextAnimationTime = millis();
+  } else {
+    Serial.println("pause");
+    nextAnimationTime = TIME_PAUSED;
+  }
+}
+
+
+int leaveState(int i) {
+  i = (i+1) % 10;
+  return enterState( i );
+}
+
+int enterState(int i) {
+  switch (i) {
+    case 0:
+      beginAnimation(new Noise());
+      break;
+    case 1:
+      beginAnimation(new Plasma());
+      break;
+    case 2:
+      beginAnimation(new Fire());
+      break;
+    case 3:
+      beginAnimation(new Descent(true));
+      break;
+    case 4:
+      beginAnimation(new Noise());
+      break;
+    case 5:
+      beginAnimation(new Fire());
+      break;
+    case 6:
+      beginAnimation(new Plasma());
+      break;
+    case 7:
+      beginAnimation(new Descent(true));
+      break;
+    case 8:
+      beginAnimation(new Fire());
+      break;
+    case 9:
+      beginAnimation(new Plasma());
+      break;
+  }
+  return i;
+}
+
+
+
+
+FWB Button;
+
+
 
 void setup() { 
   // sanity check delay - allows reprogramming if accidently blowing power w/leds

  anim = newAnim;
  newAnim->start();
}

  }
}



void loop() {
  unsigned long now = millis();
  unsigned long next = now + (1000 / FRAMES_PER_SECOND);

  Button.CheckBP();
  if (now >= nextAnimationTime) {
    NextAnimation(0);
    nextAnimationTime = now + TIME_CYCLE;
  }

  // Cycle current and previous animations
  // Continue fading between current animations
  if (anim)
    anim->loop(now);
  if (lastAnim) {
    lastAnim->loop(now);
    animTransition = qsub8(animTransition, 3);
    if (!animTransition) {
      delete lastAnim;
      lastAnim = (Animation *)0;
    }
  }
  
  // Map from the virtual matrix to the actual LEDs, blending previous
  for(int i = 0; i < NUM_LEDS; i++) {
   if (anim)
