title: Pyside6 Animated Rectangle trouble
body: <p>I'm trying to make fading looped rectangle area. I used base code from <a href="https://stackoverflow.com/questions/42493633/make-a-rectangle-blink-in-pyqt">here</a>
  Just decided expand it.
  Its just blinking rectangle, but I need smooth fade-in and fade-out effects. So I decided to make method which will calulate new opacity percent and set it to painter. But it doesnt work in cycle.</p>
  <p>This is my class now</p>
  <pre><code>class HighlightRect(QFrame):
  board_width = 400  # width of frame
  board_height = 400  #height of frame
  
  def __init__(self, parent, x, y, width=50, height=50, blink_speed=1000):
      super().__init__(parent)
      self.blink_speed = blink_speed
      self.opacity_timer = self.blink_speed
      self.board_height = self.parent().height()
      self.board_width = self.parent().width()
      self.square_height = height
      self.square_width = width
      self.highlight_x = x
      self.highlight_y = y
  
  
      #self.setFocusPolicy(QtCore.Qt.StrongFocus)
      self.timer_draw = QtCore.QTimer(self)
      self.timer_draw.timeout.connect(self.draw)
      self.timer_draw.start(self.blink_speed)
  
      self.color = QtCore.Qt.red
      self.is_draw = False
      self.x_apple = 0
      self.y_apple = 0
      self.draw()
  
  def blink(self, painter):
      self.color = QtCore.Qt.red
      while self.opacity_timer &gt;= 0:
          self.opacity_timer -= 1 / 10  # просто подбор
          percents = round(int(self.opacity_timer / self.blink_speed * 100)/100, 1)
          print(percents)
          painter.setOpacity(percents)
  
  
  
  def paintEvent(self, event):
      painter = QtGui.QPainter(self)
  
      print (&quot;Paint Event?&quot;)
      if self.is_draw == True:
          print (&quot;Draw&quot;)
          #self.color = QtCore.Qt.red
          self.blink_thread = threading.Thread(name='background', target=lambda: self.blink(painter))
          self.blink_thread.start()
      else:
  
          self.opacity_timer = self.blink_speed
          print (&quot;Do not draw&quot;)
          self.color = QtCore.Qt.transparent
          threading.SystemExit = SystemExit
      painter.setPen(self.color)
      painter.drawRect(self.rect)
  
  def draw(self):
      self.is_draw = not self.is_draw
      self.rect = QRect(self.highlight_x, self.highlight_y, self.square_width, self.square_height)
      self.update()
  </code></pre>
  <p>Changind of  opacity inside blink function but outside while loop works as well, but its static. No changes. Changing opacity in loop isn't work.
  Whats wrong?
  Maybe somewhere here is another more correct way to get what I want?</p>