| 23 | ACCENT_GREEN = (100, 255, 150) |
| 24 | |
| 25 | class ModernUI: |
| 26 | def __init__(self): |
| 27 | self.frame_count = 0 |
| 28 | self.gesture_state = "IDLE" |
| 29 | |
| 30 | def draw_gradient_circle(self, img, center, radius, color1, color2, thickness=2): |
| 31 | """Draw a gradient circle with smooth color transition""" |
| 32 | for i in range(thickness): |
| 33 | t = i / max(thickness - 1, 1) |
| 34 | blended = tuple(int(c1 * (1-t) + c2 * t) for c1, c2 in zip(color1, color2)) |
| 35 | cv2.circle(img, center, radius + i, blended, 1) |
| 36 | |
| 37 | def draw_glow_effect(self, img, center, radius, color, intensity=0.3): |
| 38 | """Enhanced glow effect with multiple layers""" |
| 39 | overlay = np.zeros_like(img, dtype=np.uint8) |
| 40 | for i in range(5): |
| 41 | alpha = intensity * (1 - i/5) |
| 42 | glow_radius = radius + i * 8 |
| 43 | cv2.circle(overlay, center, glow_radius, color, -1) |
| 44 | cv2.addWeighted(img, 1, overlay, alpha, 0, img) |
| 45 | overlay.fill(0) |
| 46 | |
| 47 | def draw_hexagon(self, img, center, radius, color, thickness=2): |
| 48 | """Draw a hexagon shape""" |
| 49 | points = [] |
| 50 | for i in range(6): |
| 51 | angle = np.deg2rad(60 * i) |
| 52 | x = int(center[0] + radius * np.cos(angle)) |
| 53 | y = int(center[1] + radius * np.sin(angle)) |
| 54 | points.append([x, y]) |
| 55 | points = np.array(points, np.int32) |
| 56 | cv2.polylines(img, [points], True, color, thickness) |
| 57 | |
| 58 | def draw_particle_ring(self, img, center, radius, color, num_particles=16): |
| 59 | """Draw animated particle ring""" |
| 60 | for i in range(num_particles): |
| 61 | angle = np.deg2rad((i * 360/num_particles) + self.frame_count * 2) |
| 62 | x = int(center[0] + radius * np.cos(angle)) |
| 63 | y = int(center[1] + radius * np.sin(angle)) |
| 64 | size = 3 + int(2 * np.sin(self.frame_count * 0.1 + i)) |
| 65 | cv2.circle(img, (x, y), size, color, -1) |
| 66 | |
| 67 | def draw_tech_lines(self, img, center, radius, color): |
| 68 | """Draw tech-style radial lines""" |
| 69 | for i in range(12): |
| 70 | angle = np.deg2rad(i * 30 + self.frame_count) |
| 71 | length = 15 if i % 3 == 0 else 10 |
| 72 | x1 = int(center[0] + (radius - length) * np.cos(angle)) |
| 73 | y1 = int(center[1] + (radius - length) * np.sin(angle)) |
| 74 | x2 = int(center[0] + radius * np.cos(angle)) |
| 75 | y2 = int(center[1] + radius * np.sin(angle)) |
| 76 | thickness = 3 if i % 3 == 0 else 2 |
| 77 | cv2.line(img, (x1, y1), (x2, y2), color, thickness) |
| 78 | |
| 79 | def draw_hud_corner(self, img, center, offset_x, offset_y, size, color): |
| 80 | """Draw modern HUD corner brackets""" |
| 81 | x, y = center[0] + offset_x, center[1] + offset_y |
| 82 | cv2.line(img, (x, y), (x + size, y), color, 2) |