Beispiel #1
0
void Spacebar::draw() {
  updateTime();
  
  ofNoFill();
  if (currentEvent.id == 0) {
    // Intro
    float rectw = easeInOut(getTime(), 0, w, 30);
    float recth = easeInOut(getTime()-15, 0, h, 15);
    float t = easeQuinticInOutBack(getTime(), 0, 1, 60);
    t *= flicker(getTime()-15,10,5);
    ofColor base = COLOR_15;
    base.lerp(KEYBOARD_COLOR,t);
    ofSetColor(base);
    ofRectRounded(ofPoint(x+(w-rectw)/2,y+(h-recth)/2), rectw, recth, r, r, r, r);
  } else if (currentEvent.id == 2) {
    float fillalpha = easeInOut(getTime(),255,0,20);
    fillalpha *= flicker(getTime(),6,3);
    
    // Draw fill
    ofSetColor(KEYBOARD_COLOR, fillalpha);
    ofFill();
    ofRectRounded(ofPoint(x,y), w, h, r, r, r, r);
    
    // Draw stroke
    ofSetColor(KEYBOARD_COLOR);
    ofNoFill();
    ofRectRounded(ofPoint(x,y), w, h, r, r, r, r);
  } else if (currentEvent.id == 1) {
    ofSetColor(KEYBOARD_COLOR);
    ofRectRounded(ofPoint(x,y), w, h, r, r, r, r);
  }
}
Beispiel #2
0
// -------- loop --------
void HitAnimation::update() {
    if (alpha > 0) {
        if (size <= MAX_SIZE && time_zoom <= HIT_DURATION) {
            //size += SIZE_INCREACE_SPEED;
            time_zoom += 0.01;
            size = easeInOut(time_zoom, 0, MAX_SIZE, HIT_DURATION);
            scoreScale = easeInOut(time_zoom, 0, 1, HIT_DURATION);
        } else if(time_score <= SCORE_DURATION){
            time_score += 0.01;
            scorePosition.x = easeInOut(time_score, position.x, -50, SCORE_DURATION);
            scoreAlpha = easeInOut(time_score, 255, -255, SCORE_DURATION);
        }
    }
}
Beispiel #3
0
void SpikeGraph::boxIntro() {
	int boxdelay = -50;
	int boxdurw = 40;
	int boxdurh = 40;

	// Boxes
	float boxh = h;
	float boxw = w;
	float tempBoxw = easeInOut(getTime() + boxdelay, 0, boxw, boxdurw);
	float tempBoxh = easeInOut(getTime() + boxdelay - boxdurw / 2, 0, boxh, boxdurh);
	ofNoFill();
	ofSetColor(COLOR_LINE, 100);
	for (float i = 0.5; i <= w + 0.5; i += 15)
		ofLine(i, 15, i, 15 + tempBoxh);
	for (float i = 0.5; i <= h + 0.5; i += 15)
		ofLine(0, i + 15, tempBoxw, i + 15);
}
Beispiel #4
0
void Key::draw() {
  updateTime();
  
  ofPushMatrix();
  {
    ofTranslate(x,y);
    
    if (currentEvent.id == 0) {
      // Intro
      if (getTime() > 0) {
        float t = easeQuinticInOutBack(getTime(), 0, 1, 60);
        t *= flicker(getTime()-5,20,5);
        ofColor base = COLOR_15;
        base.lerp(KEYBOARD_COLOR,t);
        ofSetColor(base);
        font.drawString(s, s_xoff, s_yoff);
      }
    } else if (currentEvent.id == 2) {
      float fillalpha = easeInOut(getTime(),255,0,20);
      fillalpha *= flicker(getTime(),6,3);
      // Draw rect
      ofFill();
      ofSetColor(KEYBOARD_COLOR, fillalpha);
      ofRectRounded(0,0,w,h,3);
      
      // Draw text
//      float textalpha = easeInOut(getTime(),0,150,20);
//      ofSetColor(KEYBOARD_COLOR, textalpha);
      font.drawString(s, s_xoff, s_yoff);
      
    } else if (currentEvent.id == 1) {
      ofSetColor(KEYBOARD_COLOR);
      font.drawString(s, s_xoff, s_yoff);
      
      if (debug) {
        debug_draw_bounding_rect();
      }
    }
  }
  ofPopMatrix();
}
Beispiel #5
0
InbetweenDialog::InbetweenDialog(QWidget *parent)
    : Dialog(TApp::instance()->getMainWindow(), true, "InBeetween") {
  setWindowTitle(tr("Inbetween"));

  QString linear(tr("Linear"));
  QString easeIn(tr("Ease In"));
  QString easeOut(tr("Ease Out"));
  QString easeInOut(tr("Ease In / Ease Out"));
  QStringList items;
  items << linear << easeIn << easeOut << easeInOut;

  beginHLayout();
  m_comboBox = new QComboBox(this);
  m_comboBox->addItems(items);
  addWidget(tr("Interpolation:"), m_comboBox);
  endHLayout();

  QPushButton *okBtn     = new QPushButton(tr("Inbetween"), this);
  QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
  connect(okBtn, SIGNAL(clicked()), this, SLOT(accept()));
  connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));

  addButtonBarWidget(okBtn, cancelBtn);
}