animators
Toussis Manolis
manolis at koppermind.homelinux.org
Thu Jul 10 17:53:54 CEST 2008
I try to make an animation loop in my applet...
I figure out to init the custom animator in the init() method of my applet
and then to add a slot for the customAnimationFinished() in where I try to
make a new custom animator
some code :
in init() of my applet:
m_animID=-1;
m_animDuration=1000;
connect(Plasma::Animator::self(), SIGNAL (customAnimationFinished(int) )
,this , SLOT( animationFinished(int)));
m_animID=Plasma::Animator::self()->customAnimation(10 , m_animDuration,
Plasma::Animator::EaseInOutCurve,this,"animationUpdate");
in animationUpdate slot:
void MyPlasma::animationUpdate(qreal progress)
{
kDebug() << "progress:"<< progress<< " id:"<<m_animID;
//just check out that animation timer runs ok
};
and on the slot of customAnimationFinished() :
void MyPlasma::animationFinished(int id)
{
kDebug() << "animation end";
if(id!=-1) Plasma::Animator::self()->stopCustomAnimation(id);
m_animID=Plasma::Animator::self()->customAnimation(10 , m_animDuration,
Plasma::Animator::EaseInCurve,this,"animationUpdate");
};
As you can see when the animationFinished is run , it deletes the animation,
and then it creates a new animation
The thing is that the animator runs only once... and then it freezes on the
first animationUpdate() call:
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.2 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.3 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.4 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.5 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.6 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.7 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.8 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0.9 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 1 id: 1
plasmoidviewer(21585) PlasmaTvGr::animationFinished: animation end
plasmoidviewer(21585) PlasmaTvGr::animationUpdate: progress: 0 id: 1
and no more messages about animationUpdate
Any ideas what am I doing wrong?
More information about the Panel-devel
mailing list