本文整理汇总了C++中QPropertyAnimation::setKeyValueAt方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::setKeyValueAt方法的具体用法?C++ QPropertyAnimation::setKeyValueAt怎么用?C++ QPropertyAnimation::setKeyValueAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::setKeyValueAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: determined
void HitExplosion::determined(Ts::DetermineValue value)
{
if (value == Ts::GOOD)
{
greatItem_->hide();
goodItem_->show();
}
else if (value == Ts::GREAT)
{
goodItem_->hide();
greatItem_->show();
}
else
{
return;
}
QParallelAnimationGroup *group = new QParallelAnimationGroup;
QPropertyAnimation *animation = new QPropertyAnimation(this,"opacity");
animation->setDuration(200);
animation->setKeyValueAt(0.0,0.0);
animation->setKeyValueAt(0.1,0.5);
animation->setKeyValueAt(0.9,0.5);
animation->setKeyValueAt(1.0,0.0);
group->addAnimation(animation);
show();
group->start(QAbstractAnimation::DeleteWhenStopped);
}
示例2: slotHandleDockletClicked
void QIrParabolicEffectManager::slotHandleDockletClicked()
{
QIR_P(QIrParabolicEffectManager);
QIrDock * dock = p->view->dock();
QIrDockletBundle * bundle = qobject_cast< QIrDockletBundle * >(sender());
if ( !bundle )
return;
QPropertyAnimation * animation = p->offsetAnimations[bundle];
animation->setStartValue(QPointF(0,0));
switch ( dock->dockArea() ) {
case QIrAbstractDock::DA_BottomDockArea :
animation->setKeyValueAt(0.5,QPointF(0,-20));
break;
case QIrAbstractDock::DA_TopDockArea :
animation->setKeyValueAt(0.5,QPointF(0,20));
break;
case QIrAbstractDock::DA_LeftDockArea :
animation->setKeyValueAt(0.5,QPointF(20,0));
break;
default :
animation->setKeyValueAt(0.5,QPointF(-20,0));
break;
}
animation->setEndValue(QPointF(0,0));
animation->start();
}
示例3: goBack
void CardItem::goBack(bool kieru){
if(home_pos == pos()){
if(kieru)
setOpacity(0.0);
return;
}
QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
goback->setEndValue(home_pos);
goback->setEasingCurve(QEasingCurve::OutBounce);
if(kieru){
QParallelAnimationGroup *group = new QParallelAnimationGroup;
QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
disappear->setKeyValueAt(0.9, 1.0);
disappear->setEndValue(0.0);
goback->setDuration(1000);
disappear->setDuration(1000);
group->addAnimation(goback);
group->addAnimation(disappear);
group->start(QParallelAnimationGroup::DeleteWhenStopped);
}else
goback->start(QPropertyAnimation::DeleteWhenStopped);
}
示例4: QGraphicsProxyWidget
QAbstractAnimation *QSanRoomSkin::createHuaShenAnimation(QPixmap &huashenAvatar, QPoint topLeft, QGraphicsItem *parent,
QGraphicsItem *&huashenAvatarCreated) const
{
QLabel *avatar = new QLabel;
avatar->setStyleSheet("QLabel { background-color: transparent; }");
avatar->setPixmap(huashenAvatar);
QGraphicsProxyWidget *widget = new QGraphicsProxyWidget(parent);
widget->setWidget(avatar);
widget->setPos(topLeft);
QPropertyAnimation *animation = new QPropertyAnimation(widget, "opacity");
animation->setLoopCount(2000);
JsonArray huashenConfig = _m_animationConfig["huashen"].value<JsonArray>();
int duration;
if (tryParse(huashenConfig[0], duration) && huashenConfig[1].canConvert<JsonArray>()) {
animation->setDuration(duration);
JsonArray keyValues = huashenConfig[1].value<JsonArray>();
for (int i = 0; i < keyValues.size(); i++) {
QVariant keyValue = keyValues[i];
if (!keyValue.canConvert<JsonArray>() || keyValue.value<JsonArray>().length() != 2) continue;
double step;
double val;
JsonArray keyArr = keyValue.value<JsonArray>();
if (!tryParse(keyArr[0], step) || !tryParse(keyArr[1], val)) continue;
animation->setKeyValueAt(step, val);
}
}
huashenAvatarCreated = widget;
return animation;
}
示例5: setEmotion
void Photo::setEmotion(const QString &emotion, bool permanent) {
if (emotion == ".") {
hideEmotion();
return;
}
QString path = QString("image/system/emotion/%1.png").arg(emotion);
if (QFile::exists(path)) {
QPixmap pixmap = QPixmap(path);
emotion_item->setPixmap(pixmap);
emotion_item->setPos((G_PHOTO_LAYOUT.m_normalWidth - pixmap.width()) / 2,
(G_PHOTO_LAYOUT.m_normalHeight - pixmap.height()) / 2);
_layBetween(emotion_item, _m_chainIcon, _m_roleComboBox);
QPropertyAnimation *appear = new QPropertyAnimation(emotion_item, "opacity");
appear->setStartValue(0.0);
if (permanent) {
appear->setEndValue(1.0);
appear->setDuration(500);
} else {
appear->setKeyValueAt(0.25, 1.0);
appear->setKeyValueAt(0.75, 1.0);
appear->setEndValue(0.0);
appear->setDuration(2000);
}
appear->start(QAbstractAnimation::DeleteWhenStopped);
} else {
PixmapAnimation::GetPixmapAnimation(this, emotion);
}
}
示例6: QPropertyAnimation
QAbstractAnimation *CardItem::getGoBackAnimation(bool doFade, bool smoothTransition, int duration) {
m_animationMutex.lock();
if (m_currentAnimation != NULL) {
m_currentAnimation->stop();
delete m_currentAnimation;
m_currentAnimation = NULL;
}
QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
goback->setEndValue(home_pos);
goback->setEasingCurve(QEasingCurve::OutQuad);
goback->setDuration(duration);
if (doFade) {
QParallelAnimationGroup *group = new QParallelAnimationGroup;
QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
double middleOpacity = qMax(opacity(), m_opacityAtHome);
if (middleOpacity == 0) middleOpacity = 1.0;
disappear->setEndValue(m_opacityAtHome);
if (!smoothTransition) {
disappear->setKeyValueAt(0.2, middleOpacity);
disappear->setKeyValueAt(0.8, middleOpacity);
disappear->setDuration(duration);
}
group->addAnimation(goback);
group->addAnimation(disappear);
m_currentAnimation = group;
} else {
m_currentAnimation = goback;
}
m_animationMutex.unlock();
connect(m_currentAnimation, SIGNAL(finished()), this, SIGNAL(movement_animation_finished()));
return m_currentAnimation;
}
示例7: addAudioData
void AudioChatWidgetHolder::addAudioData(const QString name, QByteArray* array)
{
if (!audioMuteCaptureToggleButton->isChecked()) {
//launch an animation. Don't launch it if already animating
if (!audioMuteCaptureToggleButton->graphicsEffect() ||
(audioMuteCaptureToggleButton->graphicsEffect()->inherits("QGraphicsOpacityEffect") &&
((QGraphicsOpacityEffect*)audioMuteCaptureToggleButton->graphicsEffect())->opacity() == 1)
) {
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(audioListenToggleButton);
audioMuteCaptureToggleButton->setGraphicsEffect(effect);
QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity");
anim->setStartValue(1);
anim->setKeyValueAt(0.5,0);
anim->setEndValue(1);
anim->setDuration(400);
anim->start();
}
// soundManager->play(VOIP_SOUND_INCOMING_CALL);
audioMuteCaptureToggleButton->setToolTip(tr("Answer"));
//TODO make a toaster and a sound for the incoming call
return;
}
if (!outputDevice) {
outputDevice = AudioDeviceHelper::getDefaultOutputDevice();
}
if (!outputProcessor) {
//start output audio device
outputProcessor = new QtSpeex::SpeexOutputProcessor();
if (inputProcessor) {
connect(outputProcessor, SIGNAL(playingFrame(QByteArray*)), inputProcessor, SLOT(addEchoFrame(QByteArray*)));
}
outputProcessor->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
outputDevice->start(outputProcessor);
}
if (outputDevice && outputDevice->error() != QAudio::NoError) {
std::cerr << "Restarting output device. Error before reset " << outputDevice->error() << " buffer size : " << outputDevice->bufferSize() << std::endl;
outputDevice->stop();
outputDevice->reset();
if (outputDevice->error() == QAudio::UnderrunError)
outputDevice->setBufferSize(20);
outputDevice->start(outputProcessor);
}
outputProcessor->putNetworkPacket(name, *array);
//check the input device for errors
if (inputDevice && inputDevice->error() != QAudio::NoError) {
std::cerr << "Restarting input device. Error before reset " << inputDevice->error() << std::endl;
inputDevice->stop();
inputDevice->reset();
inputDevice->start(inputProcessor);
}
}
示例8: createPaddingAnimation
QPropertyAnimation* LinearLayoutActor::createPaddingAnimation(const char* propertyName, qreal increaseFactor, qreal initialValue, int duration, int initialDelay)
{
// Adjust animation time
duration = VisualizationSpeed::getInstance().adjust(duration);
int totalDuration = initialDelay + duration;
// Create an animation and set its duration
QPropertyAnimation* animation = new QPropertyAnimation(this, propertyName, this);
animation->setDuration(totalDuration);
// Do not change initial value on delay
animation->setKeyValueAt(0.0, initialValue);
if ( totalDuration > 0 )
animation->setKeyValueAt(qreal(initialDelay) / totalDuration, initialValue);
animation->setKeyValueAt(1.0, initialValue + increaseFactor);
return animation;
}
示例9: tremble
void Photo::tremble() {
QPropertyAnimation *vibrate = new QPropertyAnimation(this, "x");
static qreal offset = 20;
vibrate->setKeyValueAt(0.5, x() - offset);
vibrate->setEndValue(x());
vibrate->setEasingCurve(QEasingCurve::OutInBounce);
vibrate->start(QAbstractAnimation::DeleteWhenStopped);
}
示例10: createMoveToAnimation
QPropertyAnimation* LinearLayoutActor::createMoveToAnimation(const char* propertyName, qreal endProportion, qreal startProportion, int duration, int initialDelay)
{
// Adjust animation time
duration = VisualizationSpeed::getInstance().adjust(duration);
int totalDuration = initialDelay + duration;
// Create an animation and set its duration
QPropertyAnimation* animation = new QPropertyAnimation(this, propertyName, this);
animation->setDuration(totalDuration);
// Stay at the current proportion at the beginning of the animation
animation->setKeyValueAt(0.0, startProportion);
// After the delay is finished, start from the current porportion
if ( totalDuration > 0 )
animation->setKeyValueAt(qreal(initialDelay) / totalDuration, startProportion);
// At the end of the animation, reach the desired end proportion
animation->setKeyValueAt(1.0, endProportion);
return animation;
}
示例11: goBack
QAbstractAnimation* CardItem::goBack(bool kieru,bool fadein,bool fadeout){
if(home_pos == pos()){
if(kieru && home_pos != QPointF(-6, 8))
setOpacity(0.0);
return NULL;
}
QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
goback->setEndValue(home_pos);
goback->setEasingCurve(QEasingCurve::OutQuad);
goback->setDuration(500);
if(kieru){
QParallelAnimationGroup *group = new QParallelAnimationGroup;
QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
if(fadein)disappear->setStartValue(0.0);
disappear->setEndValue(1.0);
if(fadeout)disappear->setEndValue(0.0);
disappear->setKeyValueAt(0.2, 1.0);
disappear->setKeyValueAt(0.8, 1.0);
qreal dx = home_pos.x()-pos().x();
qreal dy = home_pos.y()-pos().y();
int length = sqrt(dx*dx+dy*dy);
length = qBound(500/3,length,400);
goback->setDuration(length*3);
disappear->setDuration(length*3);
group->addAnimation(goback);
group->addAnimation(disappear);
// prevent the cover face bug
setEnabled(false);
group->start(QParallelAnimationGroup::DeleteWhenStopped);
return group;
}else
{
setOpacity(this->isEnabled() ? 1.0 : 0.7);
goback->start(QPropertyAnimation::DeleteWhenStopped);
return goback;
}
}
示例12: goBack
void CardItem::goBack(bool kieru,bool fadein,bool fadeout){
if(home_pos == pos()){
if(kieru)
setOpacity(0.0);
return;
}
QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
goback->setEndValue(home_pos);
goback->setEasingCurve(QEasingCurve::OutQuad);
goback->setDuration(300);
if(kieru){
QParallelAnimationGroup *group = new QParallelAnimationGroup;
QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
if(fadein)disappear->setStartValue(0.0);
disappear->setEndValue(1.0);
if(fadeout)disappear->setEndValue(0.0);
disappear->setKeyValueAt(0.2, 1.0);
disappear->setKeyValueAt(0.8, 1.0);
int dx = home_pos.x()-pos().x();
int dy = home_pos.y()-pos().y();
int length = sqrt(dx*dx+dy*dy);
if(length*3>500)disappear->setStartValue(0.0);
else length = 500/3;
if(length*3>1200)length =400;
goback->setDuration(length*3);
disappear->setDuration(length*3);
group->addAnimation(goback);
group->addAnimation(disappear);
// prevent the cover face bug
setEnabled(false);
group->start(QParallelAnimationGroup::DeleteWhenStopped);
}else
goback->start(QPropertyAnimation::DeleteWhenStopped);
}
示例13: animation
void PaintedWidget::animation()
{
car->setPixmap(carimg);
car->show();
QPropertyAnimation *anim = new QPropertyAnimation(car,"pos");
anim->setDuration(duration);
QPoint temp=spline.s[0]; // temp是把曲线点移动(-40,-40)的点,原先是小车左上角贴着曲线运动,这样使得右下角贴着曲线运动
temp.setX(spline.s[0].x()-40);
temp.setY(spline.s[0].y()-40);
anim->setStartValue(temp);
/*
for(int i=1;i<spline.allCount-1;i++)
{
temp.setX(spline.s[i].x()-40);
temp.setY(spline.s[i].y()-40);
anim->setKeyValueAt(((float)i)/(spline.allCount-1),temp);
}
*/
for(int i=0;i<spline.dividCount-1;i++){
temp.setX(spline.dividPoint[i].x()-40);
temp.setY(spline.dividPoint[i].y()-40);
anim->setKeyValueAt(((float)i)/(spline.dividCount-1),temp);
}
/*
temp.setX(spline.s[spline.allCount-1].x()-40);
temp.setY(spline.s[spline.allCount-1].y()-40);
anim->setEndValue(temp);
//car->move();
*/
temp.setX(spline.dividPoint[spline.dividCount-1].x()-40);
temp.setY(spline.dividPoint[spline.dividCount-1].y()-40);
anim->setEndValue(temp);
anim->start();
//qDebug()<<spline.s[0]<<" to " << spline.s[spline.allCount-1];
qDebug()<<"animation exe";
}
示例14: showWelcomePage
void Letter::showWelcomePage()
{
welcome = new WelcomePage(this);
connect(welcome, SIGNAL(welcomePageLoaded()), this, SLOT(removeWelcomePage()));
QPropertyAnimation *welAnimation = new QPropertyAnimation(welcome, "opacity");
welAnimation->setDuration(CHANGE_MSEC);
welAnimation->setStartValue(0.0);
welAnimation->setEndValue(0.0);
welAnimation->setKeyValueAt(0.8, 1);
connect(welAnimation, SIGNAL(finished()), welcome, SIGNAL(welcomePageLoaded()));
connect(welAnimation, SIGNAL(finished()), this, SLOT(showLetter()));
this->layout()->addWidget(welcome);
welAnimation->start(QAbstractAnimation::DeleteWhenStopped);
}
示例15: QLabel
LrcView::LrcView(QWidget *parent) :
QLabel(parent)
{
////////////// setGeometry(276, 113, 731, 476);
//创建 动画
lab_left_top = new QLabel(this);
lab_left_bottom = new QLabel(this);
lab_left_top ->setGeometry(20, 40, 100, 100);
lab_left_bottom ->setGeometry(20, 100, 240, 320);
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(updateGif()));
timer ->start(100);
//创建 后续歌词
textNext = new QLabel(this);
textNext ->setGeometry(260, 260, 450, 200);
textNext ->setAlignment(Qt::AlignTop);
textNext ->setStyleSheet(
"QLabel{"
// "color: rgba(40, 16, 144, 255);"
// "color: rgba(92, 133, 20, 255);"
// "color: rgba(95, 110, 13, 255);" //黄绿色
"color: rgba(38, 79, 16, 255);" //墨绿色
// "color: rgba(13, 72, 110, 255);" //蓝绿色
"font-family: 楷体;"
"font-size: 20px;"
"}"
);
//创建 当前播放歌词
currentLrc = new CurrentLrc(this);
currentLrc ->setGeometry(260, 232, 450, 26);
//创建 播放过的歌词
textPrevious = new QLabel(this);
textPrevious ->setGeometry(260, 6, 450, 225);
textPrevious ->setAlignment(Qt::AlignBottom);
textPrevious ->setStyleSheet(
"QLabel{"
"color: rgba(38, 79, 16, 255);"
"font-family: 楷体;"
"font-size: 20px;"
"}"
);
this->setMouseTracking(true);
textNext->setMouseTracking(true);
currentLrc->setMouseTracking(true);
textPrevious->setMouseTracking(true);
lab_left_top->setMouseTracking(true);
lab_left_bottom->setMouseTracking(true);
/*
QAxWidget *flash = new QAxWidget(this);
flash->setControl(QString::fromUtf8("{d27cdb6e-ae6d-11cf-96b8-444553540000}"));
QString name=qApp->applicationDirPath();
flash->dynamicCall("LoadMovie(long,string)",0,qApp->applicationDirPath()+"/top.swf");
flash->show();
QGridLayout *layout = new QGridLayout;
layout->addWidget(flash);
layout->setMargin(0);
setLayout(layout);
*/
/*
QPropertyAnimation *animation = new QPropertyAnimation(lab_left_bottom, "pos");
animation->setKeyValueAt(0.0, QPoint(lab_left_bottom->x(), lab_left_bottom->y()));
animation->setKeyValueAt(0.5, QPoint(this->x()-lab_left_bottom->width(), lab_left_bottom->y()));
animation->setKeyValueAt(1.0, QPoint(lab_left_bottom->x(), lab_left_bottom->y()));
animation->setDuration(20000);
animation->setLoopCount(-1);
animation->start();
*/
QPropertyAnimation *animation = new QPropertyAnimation(lab_left_bottom, "geometry");
animation->setKeyValueAt(0.0, QRectF(lab_left_bottom->pos(), lab_left_bottom->size()));
animation->setKeyValueAt(0.5, QRectF(lab_left_bottom->x()+50, lab_left_bottom->y()+50, lab_left_bottom->width()-100, lab_left_bottom->height()-133));
animation->setKeyValueAt(1.0, QRectF(lab_left_bottom->pos(), lab_left_bottom->size()));
animation->setDuration(20000);
animation->setLoopCount(-1);
animation->start();
}