Solved
Shape animation
I have a hexagon shape. I want to move (40,0) to (80,0), (0,0) to (40,0), (40,80) to (0,80), (80,80) to (40,80) and I want to move them back. What should be the condition? I gave a try but I couldn't see any move.
Here is my shape;
shape1.setPosition(111, 89, 80, 80);
shape1.setOrigin(0.000f, 0.000f);
shape1.setScale(1.000f, 1.000f);
shape1.setAngle(0.000f);
shape1Painter.setColor(touchgfx::Color::getColorFrom24BitRGB(122, 51, 51));
shape1.setPainter(shape1Painter);
const touchgfx::AbstractShape::ShapePoint<float> shape1Points[6] = { { 80.000f, 40.000f }, { 80.000f, 80.000f }, { 40.000f, 80.000f }, { 0.000f, 40.000f }, { 0.000f, 0.000f }, { 40.000f, 0.000f } };
shape1.setShape(shape1Points);and the animation in handleTickEvent ;
CWRUtil::Q5 currentX, currentY;
shape1.invalidate();
shape1.getCornerX(5) = currentX;
shape1.getCornerY(5) = currentY;
if (currentX < shape1.getCornerX(1))
{
shapeXChangeFactor = CWRUtil::Q5(80);
}
else if (currentX == shape1.getCornerX(1))
{
shapeXChangeFactor = CWRUtil::Q5(-80);
}
currentX = currentX + shapeXChangeFactor;
shape1.setCorner(4, currentX, currentY);
shape1.invalidate();