2025-11-19 6:09 AM
I have an animated image, and I want to make it rotate around a circle. I assume I need to use a container and somehow integrate the TextureMapper into it, but I’m not sure how to do that.
Solved! Go to Solution.
2025-11-21 12:57 AM
Hello @dvp.
Yes, you can draw the animated image to a dynamic bitmap, and then use it in a texture mapper. This can be achieved by using a cacheable container or by calling drawToDynamicBitmap().
However, depending on your application, a simpler approach might be to manually implement the animated image, as this can be done quite easily. Then, you set a new bitmap for the texture mapper every x ticks. Remember that calling setBitmap() on a texture mapper resets the texture mapper properties according to the input bitmap. Therefore, you must save the properties before setting the new bitmap and reapply the properties after setting the new bitmap.
You can achieve that by implementing something similar to this in handleTickEvent():
// Update animated image
if (!(tickCount % ANIMATION_INTERVAL))
{
// Save texture mapper properties and invalidate content
...
if (textureMapper.getBitmapId() == LAST_ANIMATION_BITMAP_ID)
{
textureMapper.setBitmap(FIRST_ANIMATION_BITMAP_ID);
}
else
{
textureMapper.setBitmap(textureMapper.getBitmapId() + 1);
}
// Set texture mapper properties and invalidate content
...
}
Best regards,
Johan
2025-11-21 12:57 AM
Hello @dvp.
Yes, you can draw the animated image to a dynamic bitmap, and then use it in a texture mapper. This can be achieved by using a cacheable container or by calling drawToDynamicBitmap().
However, depending on your application, a simpler approach might be to manually implement the animated image, as this can be done quite easily. Then, you set a new bitmap for the texture mapper every x ticks. Remember that calling setBitmap() on a texture mapper resets the texture mapper properties according to the input bitmap. Therefore, you must save the properties before setting the new bitmap and reapply the properties after setting the new bitmap.
You can achieve that by implementing something similar to this in handleTickEvent():
// Update animated image
if (!(tickCount % ANIMATION_INTERVAL))
{
// Save texture mapper properties and invalidate content
...
if (textureMapper.getBitmapId() == LAST_ANIMATION_BITMAP_ID)
{
textureMapper.setBitmap(FIRST_ANIMATION_BITMAP_ID);
}
else
{
textureMapper.setBitmap(textureMapper.getBitmapId() + 1);
}
// Set texture mapper properties and invalidate content
...
}
Best regards,
Johan