MCPcopy Index your code
hub / github.com/PyQt5/PyQt / _initAnimations

Method _initAnimations

QProgressBar/MetroCircleProgress.py:120–163  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

118 painter.restore()
119
120 def _initAnimations(self):
121 for index in range(5): # 5个小圆
122 item = CircleItem(self)
123 item.valueChanged.connect(self.update)
124 # 串行动画组
125 seqAnimation = QSequentialAnimationGroup(self)
126 seqAnimation.setLoopCount(-1)
127 self._items.append((item, seqAnimation))
128
129 # 暂停延迟动画
130 seqAnimation.addAnimation(QPauseAnimation(150 * index, self))
131
132 # 加速,并行动画组1
133 parAnimation1 = QParallelAnimationGroup(self)
134 # 透明度
135 parAnimation1.addAnimation(QPropertyAnimation(
136 item, b'opacity', self, duration=400, startValue=0, endValue=1.0))
137 # x坐标
138 parAnimation1.addAnimation(QPropertyAnimation(
139 item, b'x', self, duration=400, startValue=0, endValue=25.0))
140 seqAnimation.addAnimation(parAnimation1)
141 ##
142
143 # 匀速
144 seqAnimation.addAnimation(QPropertyAnimation(
145 item, b'x', self, duration=2000, startValue=25.0, endValue=75.0))
146
147 # 加速,并行动画组2
148 parAnimation2 = QParallelAnimationGroup(self)
149 # 透明度
150 parAnimation2.addAnimation(QPropertyAnimation(
151 item, b'opacity', self, duration=400, startValue=1.0, endValue=0))
152 # x坐标
153 parAnimation2.addAnimation(QPropertyAnimation(
154 item, b'x', self, duration=400, startValue=75.0, endValue=100.0))
155 seqAnimation.addAnimation(parAnimation2)
156 ##
157
158 # 暂停延迟动画
159 seqAnimation.addAnimation(
160 QPauseAnimation((5 - index - 1) * 150, self))
161
162 for _, animation in self._items:
163 animation.start()
164
165 def sizeHint(self):
166 return QSize(100, self.Radius * 2)

Callers 1

__init__Method · 0.95

Calls 2

CircleItemClass · 0.85
startMethod · 0.45

Tested by

no test coverage detected