Hi, I want to create a 2d circular loading bar. I’ve tried with a LineSegs that draw lines in a circular way, and it do the job, but not perfectly if I have to say it.
I use this function like argument of a LerpFunc (step 0 to self._BAR_STEPS)
def _update_loading_bar(self, step): a = angleRadians * step / self._BAR_STEPS y = math.sin(a) x = math.cos(a) pos = (x, 0, y) self._line_seg.drawTo(pos) node = self._line_seg.create() # if self._bar_node_path != None: # self._bar_node_path.removeNode() self._bar_node_path = render2d.attachNewNode(node) self._bar_node_path.reparent_to(self._time_label) self._bar_node_path.setScale(0.4)
The result have jagged edges even with self._BAR_STEPS very high. Is there a better way to achieve something like this? Thanks in advance.