void BasicScreenObject::hide(float _time){ fadeTo(0, _time); visibletimer.setup(_time/1000, false); visibletimer.stopTimer(); ofAddListener(visibletimer.TIMER_REACHED, this, &BasicScreenObject::hideAfterTimer); visibletimer.startTimer(); }
void VolumeFaderEffect::setParameterValue(const EffectParameter &p, const QVariant &newValue) { K_XT(VolumeFaderEffect); const int parameterId = p.id(); debug() << Q_FUNC_INFO << parameterId << newValue; switch (static_cast<ParameterIds>(parameterId)) { case VolumeParameter: setVolume(newValue.toDouble()); break; case FadeCurveParameter: setFadeCurve(static_cast<Phonon::VolumeFaderEffect::FadeCurve>(newValue.toInt())); break; case FadeToParameter: xt->m_parameters.fadeTo = newValue.toDouble(); break; case FadeTimeParameter: xt->m_parameters.fadeTime = newValue.toInt(); break; case StartFadeParameter: if (newValue.toBool()) { fadeTo(xt->m_parameters.fadeTo, xt->m_parameters.fadeTime); } break; default: qWarning() << "request for unknown parameter " << parameterId; break; } }
int main(void) { setup(); while(1) { if (timer == 0) { timer = 100000; if (state == 0) { fadeTo(31,0,0, 31,0,0, 31,0,0); } else if (state == 1) { fadeTo(31,31,0, 31,31,0, 31,31,0); } else if (state == 2) { fadeTo(0,31,0 ,0,31,0, 0,31,0); } else if (state == 3) { fadeTo(0,31,31, 0,31,31, 0,31,31); } else if (state == 4) { fadeTo(0,0,31, 0,0,31, 0,0,31); } else if (state == 5) { fadeTo(31,0,31, 31,0,31, 31,0,31); } else if (state == 6) { fadeTo(16,0,16, 16,0,16, 16,0,16); } else if (state == 7) { fadeTo(8,0,8, 8,0,8, 8,0,8); } else if (state == 8) { fadeTo(4,0,4, 4,0,4, 4,0,4); } else if (state == 9) { fadeTo(2,0,2, 2,0,2, 2,0,2); } state++; if (state == 10) state = 0; } PORTA = (PORTA&0xF8)|portASlots[TCNT0%32]; PORTC = (PORTC&0xC0)|portCSlots[TCNT0%32]; if (fading) { if (TCNT0 == 255) { stepCount++; } if (stepCount == 16) { stepFade(); stepCount = 0; } } timer--; } return 0; }
void textManager::setActiveQuote(int quoteId){ activeQuoteID = quoteId; if(quoteId == 0){ fadeTo(0, 50); } else{ loadNewQuote = true; } }
CreditContext::~CreditContext(){ if( previousScreen != NULL ){ fadeTo(screen, previousScreen, 1000); SDL_FreeSurface(previousScreen); } if( !oldCap.empty() ){ SDL_WM_SetCaption(oldCap.c_str(), NULL); } InfraellyMixer::stopMusic(); InfraellyMixer::popFrontMusicQueue(); InfraellyMixer::playMusic(); }
void textManager::update(){ if(loadNewQuote){ //load the image for that quote quote.loadImage("quotes/"+ofToString(activeQuoteID)+".png"); fadeTo(fadeToValue, 100); loadNewQuote = false; } //find the wave by id textFbo.begin(); //set alpha alpha += (targetAlpha - alpha)/fadeSpeed; // alpha = round(alpha); cout<<"targetAlpha: "<<targetAlpha<<endl; cout<<"alpha: "<<alpha<<endl; ofSetColor(255, 255, 255, alpha); //ofClearAlpha(); ofClear(0,0,0,0); //need to enable these special blame functions in order to properly blend apha PNGs //glPushAttrib(GL_ALL_ATTRIB_BITS); //glEnable(GL_BLEND); //glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA); ledWavePanels * w; int cropY = 0; for(int wcnt = 0; wcnt<wavesPanels.size(); wcnt++){ w = wavesPanels.at(wcnt); //draw the text to the correct location in the text fbo layer quote.drawSubsection(w->_x, w->_y, w->_w, w->_h, 0, cropY); cropY+=w->_h; } textFbo.end(); textFbo.readToPixels(pixels); }
//assume PWM void LED::fadeOut(unsigned int time, bool synchronous) { fadeTo(0, time, synchronous); }
//assume PWM void LED::fadeIn(unsigned int time, bool synchronous) { fadeTo(255, time, synchronous); }
void BasicScreenObject::fadeTo(float _endalpha, float _fadetime, float (ofxTransitions::*ease) (float,float,float,float)) { fadeTo(_endalpha, _fadetime, ease, 0); }
void BasicScreenObject::fadeTo(float _endalpha, float _fadetime) { fadeTo(_endalpha, _fadetime, &ofxTransitions::easeInOutCubic, 0); }
void BasicScreenObject::show(float _time){ ofNotifyEvent(showEvent, myEventArgs, this); ofRemoveListener(visibletimer.TIMER_REACHED, this, &BasicScreenObject::hideAfterTimer); isVisible(true); fadeTo(255, _time); }
CreditContext::CreditContext() : previousScreen(duplicateSurface(screen)), fontSize(24), y( screen->h ) { // Set window caption SDL_WM_SetCaption("Infraelly Credits", NULL); //set fps fpsManager.setMaxFps(30); // player music InfraellyMixer::stopMusic(); InfraellyMixer::playMusic("audio/always_alone.ogg",-1, 1000); /* credit listing. Vector is used opposed to array to avoid having to re-number all elements, after each new insertion*/ creditListing.push_back("-._.-~~-._.-~~-._.-~~-."); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-------------------------~"); creditListing.push_back("Thank you to the authors of the following libraries, used in Infraelly"); creditListing.push_back("~-------------------------~"); creditListing.push_back("SDL - Simple Directmedia Layer"); creditListing.push_back("SDL_mixer"); creditListing.push_back("SDL_TTF"); creditListing.push_back("SDL_image"); creditListing.push_back("SDL_net"); creditListing.push_back("SDL_gfx"); creditListing.push_back("Net2"); creditListing.push_back("Libpng (used by SDL_image)"); creditListing.push_back("Zlib (used by Libpng)"); creditListing.push_back("FreeType Project (used by SDL_ttf)"); creditListing.push_back("guichan"); creditListing.push_back("TinyXml"); creditListing.push_back("Crypto++"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-------------------------~"); creditListing.push_back("Default Fonts"); creditListing.push_back("~-------------------------~"); creditListing.push_back("Thank you to Larabie Fonts to for their excellent free fonts"); creditListing.push_back("The following fonts were used:"); creditListing.push_back("Forgotten Futurist (TrueType)"); creditListing.push_back("Effloresce (TrueType)"); creditListing.push_back("Credit Valley (TrueType)"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-------------------------~"); creditListing.push_back("Infraelly Music and Sound effects"); creditListing.push_back("~-------------------------~"); creditListing.push_back("insanepotato"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-------------------------~"); creditListing.push_back("Infraelly Graphics and Design"); creditListing.push_back("~-------------------------~"); creditListing.push_back("mah SiSteR"); creditListing.push_back("insanepotato"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-------------------------~"); creditListing.push_back("Infraelly Website"); creditListing.push_back("~-------------------------~"); creditListing.push_back("xtiaDesign"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-------------------------~"); creditListing.push_back("Infraelly Programing"); creditListing.push_back("~-------------------------~"); creditListing.push_back("insanepotato"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-------------------------~"); creditListing.push_back("Contacting me"); creditListing.push_back("~-------------------------~"); creditListing.push_back("If there are any problems or bugs you would like to discuss with me;"); creditListing.push_back("or even if you just want to chat, you can contact me via"); creditListing.push_back(""); creditListing.push_back("E-mail: [email protected]"); creditListing.push_back("MSN-IM: [email protected]"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("~-----------------------~"); creditListing.push_back("Thank you"); creditListing.push_back("~-----------------------~"); creditListing.push_back("Thank YOU for choosing Infraelly =)"); creditListing.push_back(""); creditListing.push_back("A final thanks to the authors and contributors of the afore mentioned libraries"); creditListing.push_back("I love you all long time <3"); creditListing.push_back(""); creditListing.push_back("BloodShed Software for making an awesome IDE"); creditListing.push_back(""); creditListing.push_back("The Code::Blocks team for making an even better IDE!"); creditListing.push_back(""); creditListing.push_back("CrossFire MMORPG... i had a peek at your server's source code ;D"); creditListing.push_back(""); creditListing.push_back("Mr. Jacobs"); creditListing.push_back(""); creditListing.push_back("Aloo"); creditListing.push_back(""); creditListing.push_back("AsianFace, you showed me hell <3"); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back(""); creditListing.push_back("Have a nice day =)"); //used to draw text down the screen in 'lines' line = getStringHeight(font::creditFont.at(fontSize), "IPYHGgyipqQeoSa 0"); line += 15; /*total height of the credit listing. 50 is added to the end, after its finished scrolling, there is a delay before it reappears at the bottom*/ totalHeight = -line*creditListing.size()-3*line; //black box so "Press ESC to return" will appears on top of listing SDL_Rect escBox; escBox.x = 0; escBox.y = 0; escBox.w = screen->w; escBox.h = 15; //fade to black (fade into credits) fadeTo(screen, colour::black, 1000); run(); }
inline void fadeTo(::xpcc::color::Hsv color, uint16_t time) { color.toRgb(&absolute); fadeTo(absolute, time); }