コード例 #1
0
ファイル: keyboard.cpp プロジェクト: JIVS/dex-ui
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);
  }
}
コード例 #2
0
ファイル: keyboard.cpp プロジェクト: JIVS/dex-ui
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();
}
コード例 #3
0
ファイル: main.c プロジェクト: akafugu/ledcandle
int main(void)
{
	// Attiny13A fuse setting: -U lfuse:w:0x7A:m -U hfuse:w:0xFB:m
	//
	// set system-clock prescaler to 1/8
	// 4.8MHz RC-oscillator --> 600kHz system-clock
	CLKPR = _BV(CLKPCE);
	CLKPR = _BV(CLKPS1) | _BV(CLKPS0);

	// configure TIMER0
	TCCR0A = _BV(WGM01);	// set CTC mode
	TCCR0B = ( _BV(CS01) );	// set prescaler to 8
	// enable COMPA ISR
	TIMSK0 = _BV(OCIE0A);
	// set top value for TCNT0
	OCR0A = 10;		// just some start value

	// pull-up on for BUTTON_PIN
	PORT_OUT_REG |= _BV(BUTTON_PIN);
	// set port directions
	PORT_DIR_REG = PORT_DIR_MASK;
	
	// disable analog comparator to save power
	ACSR = _BV(ACD);

	// Pin change interrupt enabled
	// The actual pin will be activated later
	GIMSK |= _BV(PCIE);
		
	// globally enable interrupts
	// necessary to wake up from sleep via pin-change interrupt
	sei();

	fade(0,255,1);

	while (1) {
		// the flag 'sleep_requested' is set in the ISR: TIM0_COMPA_vect
		if(sleep_requested == 1) {
			do_sleep();
		}
		flicker();
	}
}
コード例 #4
0
ファイル: EpLight.cpp プロジェクト: gasbank/poolg
LRESULT EpLight::handleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	D3DXCOLOR color( 1.0f, 0.0f, 0.0f, 1.0f );
	//static ArnVec3 vPos( -38.0f, -10.0f, 10.0f) ;
	switch ( uMsg )
	{
	case WM_KEYDOWN:
		switch( wParam )
		{
		case 'I':
			stopFlicker();
			fadeInLight();
			break;
		case 'O':
			fadeOutLight();
			break;
		case 'F':
			setFlickerColor( color );
			setFadeDuration( 0.5f );
			flicker( 10.0f );
			break;
	/*	case VK_UP:
			vPos.x += 1.0f;
			break;
		case VK_DOWN:
			vPos.x -= 1.0f;
			break;
		case VK_LEFT:
			vPos.y += 1.0f;
			break;
		case VK_RIGHT:
			vPos.y -= 1.0f;
			break;*/
		}
		break;
	}

	/*setLightPos(vPos);*/

	return S_OK;
}