-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbanner.py
More file actions
53 lines (44 loc) · 1.87 KB
/
banner.py
File metadata and controls
53 lines (44 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from PyQt5.QtWidgets import QLabel
from PyQt5.QtCore import QPropertyAnimation, QRect, Qt, QTimer
from PyQt5.QtGui import QLinearGradient, QBrush, QFont, QPainter, QColor
class AnimatedBanner(QLabel):
def __init__(self, text="DevDaRK Kabo", parent=None):
super().__init__(parent)
self.setText(text)
self.setObjectName("banner")
self.setAlignment(Qt.AlignCenter)
self.setGeometry(0, -60, 600, 60)
self.setFont(QFont("Segoe UI", 28, QFont.Bold))
# إعدادات الفلاش
self.flash_intensity = 0
self.flash_direction = 1
# مؤقت لتحديث الرسوم
self.timer = QTimer(self)
self.timer.timeout.connect(self.update_effects)
self.timer.start(80)
self.animate()
def animate(self):
self.anim = QPropertyAnimation(self, b"geometry")
self.anim.setDuration(3000)
self.anim.setStartValue(QRect(0, -60, 600, 60))
self.anim.setEndValue(QRect(0, 20, 600, 60))
self.anim.setLoopCount(-1)
self.anim.start()
def update_effects(self):
# تأثير الفلاش المتوهج
self.flash_intensity += self.flash_direction * 15
if self.flash_intensity >= 255 or self.flash_intensity <= 100:
self.flash_direction *= -1
self.update()
def paintEvent(self, event):
painter = QPainter(self)
gradient = QLinearGradient(0, 0, self.width(), 0)
# ألوان متوهجة متغيرة
glow_color = QColor(0, self.flash_intensity, 255)
gradient.setColorAt(0, QColor("#0f0f0f"))
gradient.setColorAt(0.5, glow_color)
gradient.setColorAt(1, QColor("#0f0f0f"))
painter.setPen(QColor("#00ffcc"))
painter.setBrush(QBrush(gradient))
painter.setFont(self.font())
painter.drawText(self.rect(), Qt.AlignCenter, self.text())