adjusting news manager scroll speed

This commit is contained in:
Chuck
2025-07-27 12:42:12 -05:00
parent e5d4f3c9f0
commit 4ab4d14a4e

View File

@@ -336,6 +336,9 @@ class NewsManager:
# Calculate scroll position for smooth animation # Calculate scroll position for smooth animation
if self.total_scroll_width > 0: if self.total_scroll_width > 0:
# Use modulo for continuous scrolling like stock ticker
self.scroll_position = (self.scroll_position + self.scroll_speed) % self.total_scroll_width
# Scroll from right to left # Scroll from right to left
x_pos = width - self.scroll_position x_pos = width - self.scroll_position
@@ -346,12 +349,8 @@ class NewsManager:
if x_pos + self.total_scroll_width < width: if x_pos + self.total_scroll_width < width:
draw.text((x_pos + self.total_scroll_width, y_pos), self.cached_text, font=font, fill=self.text_color) draw.text((x_pos + self.total_scroll_width, y_pos), self.cached_text, font=font, fill=self.text_color)
# Update scroll position # Check if we should rotate headlines (when scroll wraps around)
self.scroll_position += self.scroll_speed if self.scroll_position == 0:
# Reset scroll when text has completely passed
if self.scroll_position >= self.total_scroll_width:
self.scroll_position = 0
self.rotation_count += 1 self.rotation_count += 1
# Check if we should rotate headlines # Check if we should rotate headlines