src/hbcore/effects/hbeffecttranslate.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 5 627c4a0fd0e7
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    32 
    32 
    33 HbEffectTranslateAnimation::HbEffectTranslateAnimation(
    33 HbEffectTranslateAnimation::HbEffectTranslateAnimation(
    34     HbEffectGroup *group,
    34     HbEffectGroup *group,
    35     HbEffectTranslate *effect,
    35     HbEffectTranslate *effect,
    36     int duration) :
    36     int duration) :
    37         HbEffectAnimation(),
    37         HbEffectAnimation(group),
    38         group(group),
       
    39         effect(effect)
    38         effect(effect)
    40 {
    39 {
    41     setDuration(duration);
    40     setDuration(duration);
    42 }
    41 }
    43 
    42 
    46     originalPos = pos;
    45     originalPos = pos;
    47 }
    46 }
    48 
    47 
    49 void HbEffectTranslateAnimation::handleAnimationUpdate(const QVariant &value)
    48 void HbEffectTranslateAnimation::handleAnimationUpdate(const QVariant &value)
    50 {
    49 {
    51     if (group->isRunning()) {
    50     if (mGroup->isRunning()) {
    52         currentPos = qVariantValue<qreal>(value);
    51         currentPos = qVariantValue<qreal>(value);
    53         group->updateItemTransform();
    52         mGroup->updateItemTransform();
    54     }
    53     }
    55 }
    54 }
    56 
    55 
    57 void HbEffectTranslateAnimation::handleAnimationFinish()
    56 void HbEffectTranslateAnimation::handleAnimationFinish()
    58 {
    57 {
   116 	    }
   115 	    }
   117     }
   116     }
   118 
   117 
   119     if (durationX > 0) {
   118     if (durationX > 0) {
   120         mAnimationX = new HbEffectTranslateAnimation(group, this, durationX);
   119         mAnimationX = new HbEffectTranslateAnimation(group, this, durationX);
   121         mAnimationX->addLooping(paramX, group);
   120         mAnimationX->addLooping(paramX);
   122         mAnimationX->mCurve = curveShapeX;
   121         mAnimationX->mCurve = curveShapeX;
   123     }
   122     }
   124 
   123 
   125     // Create at least one animation even if both durations are zero for handling animation finish easily.
   124     // Create at least one animation even if both durations are zero for handling animation finish easily.
   126     if (durationY > 0 || !mAnimationX) {
   125     if (durationY > 0 || !mAnimationX) {
   127         mAnimationY = new HbEffectTranslateAnimation(group, this, durationY);
   126         mAnimationY = new HbEffectTranslateAnimation(group, this, durationY);
   128         mAnimationY->addLooping(paramY, group);
   127         mAnimationY->addLooping(paramY);
   129         mAnimationY->mCurve = curveShapeY;
   128         mAnimationY->mCurve = curveShapeY;
   130     }
   129     }
   131 }
   130 }
   132 
   131 
   133 /*  Deletes the effect and rewinds the animation so that next animation can start,
   132 /*  Deletes the effect and rewinds the animation so that next animation can start,