コード例 #1
0
ファイル: Objet.cpp プロジェクト: Babouchot/Epoch
//Constructeur
Objet::Objet()
{
    type = CERCLE;
	pos.set(0,0);
	taille.set(10,10);
	vitdir.set(0.71,0.71);
    setVitesse(0.1);
	r=1.0f;g=1.0f;b=1.0;

    setDernierTps();
}
コード例 #2
0
ファイル: objetvolant.cpp プロジェクト: maidmaid/maiday
void ObjetVolant::init()
{
    //Initialise les variables
    setZValue(1);
    setPilotage(manuel);
    setDessinerTrajectoire(false);
    creerImageParDefaut();
    setLooping(0);

    setVitesseAngulaireObjet(180.0 / 1000.0);
    setAccelerationObjet(100.0 / 1000000.0);
    setVitesseMinObjet(100.0 / 1000.0);
    setVitesseMaxObjet(300.0 / 1000.0);

    setPosition(QPointF(0, 0));
    setVitesseAngulaire(0);
    setAngle(vitesseAngulaire() * 0);
    setAcceleration(0);
    setVitesse(vitesseMinObjet());

    //Animation du looping
    animationLooping = new QPropertyAnimation(this, "looping");
    animationLooping->setDuration(500);
    animationLoopingRoot = new QSequentialAnimationGroup(this);
    animationLoopingRoot->addPause(1500); //Attend un moment avant de se retourner
    animationLoopingRoot->addAnimation(animationLooping);

    //Animation de la position
    animationPosition = new QPropertyAnimation(this, "position");
    animationPosition->setDuration(25);

    //Animation de l'angle
    setTransformOriginPoint(boundingRect().center()); //Met le centre de rotation au centre de l'Item
    animationAngle = new QPropertyAnimation(this, "angle");
    animationAngle->setDuration(25);

    //Animation de la vitesse
    animationVitesse = new QPropertyAnimation(this, "vitesse");
    animationVitesse->setDuration(25);

    //Animation principale des déplacements
    animationRoot = new QParallelAnimationGroup(this);
    animationRoot->addAnimation(animationAngle);
    animationRoot->addAnimation(animationVitesse);
    animationRoot->addAnimation(animationPosition);
    connect(animationRoot, SIGNAL(finished()), this, SLOT(seDeplacer()));

    temps.start();
    seDeplacer();
}