Is there a way to create a tiling widget that automatically tiles when scaling (no stretching)?

I have a UI element that is essentially a laser beam. It moves in a straight line until it hits something. The beam will be animated. For sake of discussion, let’s say it will look something like this gif I found on Google:


Ignore the bit on the left and assume that the beam looks the same across its entire length.

How can I create a UI element that can be scaled horizontally such that it won’t stretch but instead will tile infinitely?

Borders can tile images: