I want to make a dynamic text animation with Qt for arabic and persian texts?can you help me? You can see an example of what i need.
Trust sample
wrong sample
I want to make a dynamic text animation with Qt for arabic and persian texts?can you help me? You can see an example of what i need.
Trust sample
wrong sample
I suggest to use the following classes: QGraphicsScene
and QGraphicsView
to handle and display your graphics, QGraphicsTextItem
to display each character, QGraphicsItemAnimation
to animate characters.
I do not know how exactly acts the example you've posted and which transformations are applied. I wrote a simple example. Here the initial rotation and translation of each item is set randomly, and the final positions are without any transformation.
QString text = "test";
int current_width = 0;
QFont font("", 30);
QTimeLine *timeline = new QTimeLine(2000);
foreach(QChar c, text) {
QGraphicsTextItem* item = scene.addText(c);
item->setFont(font);
item->adjustSize();
item->setPos(current_width, 0);
current_width += item->textWidth();
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(item);
animation->setTimeLine(timeline);
animation->setRotationAt(0, 360.0 * rand() / RAND_MAX);
animation->setTranslationAt(0, 100 * rand() / RAND_MAX,
100 * rand() / RAND_MAX);
animation->setRotationAt(1, 0);
animation->setTranslationAt(1, 0, 0);
}
ui.graphicsView->setScene(&scene);
timeline->start();