void Configurator::removeTween() { QString name = k->tweenManager->currentTweenName(); k->tweenManager->removeItemFromList(); removeTween(name); }
void Configurator::setButtonsPanel() { k->controlPanel = new ButtonsPanel(this); connect(k->controlPanel, SIGNAL(clickedEditTween()), this, SLOT(editTween())); connect(k->controlPanel, SIGNAL(clickedRemoveTween()), this, SLOT(removeTween())); k->settingsLayout->addWidget(k->controlPanel); activeButtonsPanel(false); }
void Tweener::step(long currentMillis) { //fix thanks for Etienne Mouchel if(lastTime == 0) lastTime = currentMillis; total_tweens = tweens.size(); int t = 0 ; int d = 0; int dif = (currentMillis - lastTime); for (tweensIT = tweens.begin(); tweensIT != tweens.end(); ++tweensIT ) { if (!(*tweensIT).started) { dispatchEvent(&(*tweensIT), ON_START); (*tweensIT).started = true; } dispatchEvent(&(*tweensIT), ON_STEP); if ((*tweensIT).onStepCallBack){ (*tweensIT).onStepCallBack(); } if ((*tweensIT).useMilliSeconds == true) { ((*tweensIT).timeCount)+=dif; t = (*tweensIT).timeCount ; } else { ((*tweensIT).timeCount)++; t =(*tweensIT).timeCount; } if ( (*tweensIT).delayFinished ) { d = (*tweensIT).time ; if ( t < d && (*tweensIT).total_properties > 0 ) { if ((*tweensIT).timeCount < (*tweensIT).time ) { for (unsigned int i =0 ; i < (*tweensIT).total_properties; i++ ) { TweenerProperty prop = (*tweensIT).properties[i]; if (prop.ptrValue != NULL ) { float res = runEquation( (*tweensIT).transition, (*tweensIT).equation, t, prop.initialValue, (prop.finalValue - prop.initialValue ), d); *(prop.ptrValue) = res; } } } } else { if ((*tweensIT).decreaseRepeat() < 0 ) { //garante o valor final /*for (unsigned int i =0 ; i < (*tweensIT).total_properties; i++ ) { TweenerProperty prop = (*tweensIT).properties[i]; if (prop.ptrValue != NULL ) { *(prop.ptrValue) = prop.finalValue; } }*/ dispatchEvent(&(*tweensIT), ON_COMPLETE); if ((*tweensIT).onCompleteCallBack){ (*tweensIT).onCompleteCallBack(); (*tweensIT).onCompleteCallBack = 0; (*tweensIT).onStepCallBack = 0; } removeTween(&(*tweensIT)); tweensIT = tweens.begin(); if(total_tweens == 0) //if the tweener is empty again this way for the next param adding the dif won't be huge and it won't skip the tweening lastTime = 0; } } } else if ((!(*tweensIT).delayFinished) && ((*tweensIT).timeCount > (*tweensIT).delay)) { (*tweensIT).delayFinished = true; (*tweensIT).timeCount = 0; } } if(lastTime != 0) lastTime = currentMillis; };