Help drawing part of an image

I’m using currently tiling an image to make a 2D energy bar using OnScreenImage. First, only part of the bar will be filled at any time, so I need to only draw part of the last image. The image isn’t vertically homogeneous either so scaling won’t work.

Also, I’d like to animate the bar so that it has the appearance of a barber shop pole (lines scrolling upwards). If I could draw part of an image, then I could just move the other images around each frame to do this, but it seems like there should be a better way.

Any ideas?

Consider just applying a texture to your bar, and then adjusting the UV’s to get the effect you want. You can achieve both of these effects with setTexScale() and setTexOffset(). Since the UV’s are independent of the vertex position, you can still scale the bar to make it bigger while you counter-scale the UV’s to keep the texture the same apparent size.

Or, you can also use the projected texture effect to keep the UV’s the same apparent size and position automatically.

Here’s another thread where someone was asking about something similar:
https://discourse.panda3d.org/viewtopic.php?t=8369

David