animpy 1.2__tar.gz → 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {animpy-1.2 → animpy-1.2.1}/PKG-INFO +3 -6
- {animpy-1.2 → animpy-1.2.1}/README.md +2 -5
- {animpy-1.2 → animpy-1.2.1}/animpy.egg-info/PKG-INFO +3 -6
- {animpy-1.2 → animpy-1.2.1}/animpy.py +19 -25
- {animpy-1.2 → animpy-1.2.1}/pyproject.toml +1 -1
- {animpy-1.2 → animpy-1.2.1}/LICENSE +0 -0
- {animpy-1.2 → animpy-1.2.1}/animpy.egg-info/SOURCES.txt +0 -0
- {animpy-1.2 → animpy-1.2.1}/animpy.egg-info/dependency_links.txt +0 -0
- {animpy-1.2 → animpy-1.2.1}/animpy.egg-info/top_level.txt +0 -0
- {animpy-1.2 → animpy-1.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: animpy
|
|
3
|
-
Version: 1.2
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: A simple terminal animation library
|
|
5
5
|
Author: Samin Riyaz
|
|
6
6
|
License: MIT License
|
|
@@ -47,11 +47,8 @@ Animpy is a simple animation library for creating cool terminal animations. It g
|
|
|
47
47
|
|
|
48
48
|
The particle simulator shown above was made entirely with Animpy.
|
|
49
49
|
|
|
50
|
-
## What's New in 1.2
|
|
51
|
-
|
|
52
|
-
- **Type Out Effect** – New `type_out()` method for animated text typing effect
|
|
53
|
-
- **Gravity/Fall Effect** – New `fall()` method to create gravity and falling text animations
|
|
54
|
-
- **Improved Render Graphics** – Optimized rendering using buffered output to eliminate ghosting effects and improve animation smoothness; now uses efficient ANSI escape sequences for RGB color rendering
|
|
50
|
+
## What's New in 1.2.1
|
|
51
|
+
- **Reduced Terminal Footprint** – Animations now only occupy a few lines instead of consuming the entire terminal, making output much cleaner and more efficient
|
|
55
52
|
|
|
56
53
|
## What Can You Do?
|
|
57
54
|
|
|
@@ -12,11 +12,8 @@ Animpy is a simple animation library for creating cool terminal animations. It g
|
|
|
12
12
|
|
|
13
13
|
The particle simulator shown above was made entirely with Animpy.
|
|
14
14
|
|
|
15
|
-
## What's New in 1.2
|
|
16
|
-
|
|
17
|
-
- **Type Out Effect** – New `type_out()` method for animated text typing effect
|
|
18
|
-
- **Gravity/Fall Effect** – New `fall()` method to create gravity and falling text animations
|
|
19
|
-
- **Improved Render Graphics** – Optimized rendering using buffered output to eliminate ghosting effects and improve animation smoothness; now uses efficient ANSI escape sequences for RGB color rendering
|
|
15
|
+
## What's New in 1.2.1
|
|
16
|
+
- **Reduced Terminal Footprint** – Animations now only occupy a few lines instead of consuming the entire terminal, making output much cleaner and more efficient
|
|
20
17
|
|
|
21
18
|
## What Can You Do?
|
|
22
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: animpy
|
|
3
|
-
Version: 1.2
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: A simple terminal animation library
|
|
5
5
|
Author: Samin Riyaz
|
|
6
6
|
License: MIT License
|
|
@@ -47,11 +47,8 @@ Animpy is a simple animation library for creating cool terminal animations. It g
|
|
|
47
47
|
|
|
48
48
|
The particle simulator shown above was made entirely with Animpy.
|
|
49
49
|
|
|
50
|
-
## What's New in 1.2
|
|
51
|
-
|
|
52
|
-
- **Type Out Effect** – New `type_out()` method for animated text typing effect
|
|
53
|
-
- **Gravity/Fall Effect** – New `fall()` method to create gravity and falling text animations
|
|
54
|
-
- **Improved Render Graphics** – Optimized rendering using buffered output to eliminate ghosting effects and improve animation smoothness; now uses efficient ANSI escape sequences for RGB color rendering
|
|
50
|
+
## What's New in 1.2.1
|
|
51
|
+
- **Reduced Terminal Footprint** – Animations now only occupy a few lines instead of consuming the entire terminal, making output much cleaner and more efficient
|
|
55
52
|
|
|
56
53
|
## What Can You Do?
|
|
57
54
|
|
|
@@ -66,21 +66,19 @@ sys.stdout.write("\033[?25l")
|
|
|
66
66
|
atexit.register(lambda: (sys.stdout.write("\033[?25h"), sys.stdout.flush()))
|
|
67
67
|
|
|
68
68
|
class Text:
|
|
69
|
-
def __init__(self, text
|
|
70
|
-
|
|
71
|
-
self.
|
|
69
|
+
def __init__(self, text, x, y, r=255, g=255, b=255):
|
|
70
|
+
# If 'text' is a list, we store it for frames; otherwise, it's just a string
|
|
71
|
+
self.frames = text if isinstance(text, list) else [text]
|
|
72
|
+
self.current_frame_idx = 0
|
|
73
|
+
self.text = self.frames[0] # The current string for the renderer
|
|
74
|
+
|
|
75
|
+
self.x, self.y = x, y
|
|
76
|
+
self.r, self.g, self.b = r, g, b
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
self.
|
|
76
|
-
|
|
77
|
-
if isinstance(text, list):
|
|
78
|
-
self.text_list = text # store the list
|
|
79
|
-
self.current_frame = 0
|
|
80
|
-
self.text = text[0] # current visible text
|
|
81
|
-
else:
|
|
82
|
-
self.text_list = None
|
|
83
|
-
self.text = text
|
|
78
|
+
def change_frame(self):
|
|
79
|
+
"""Cycles through the list of frames"""
|
|
80
|
+
self.current_frame_idx = (self.current_frame_idx + 1) % len(self.frames)
|
|
81
|
+
self.text = self.frames[self.current_frame_idx]
|
|
84
82
|
|
|
85
83
|
def moveX(self, newX: int) -> None:
|
|
86
84
|
self.x = newX
|
|
@@ -94,11 +92,6 @@ class Text:
|
|
|
94
92
|
def centerY(self):
|
|
95
93
|
self.y = terminal_size.lines // 2
|
|
96
94
|
|
|
97
|
-
def change_frame(self) -> None:
|
|
98
|
-
if self.text_list:
|
|
99
|
-
self.current_frame = (self.current_frame + 1) % len(self.text_list)
|
|
100
|
-
self.text = self.text_list[self.current_frame]
|
|
101
|
-
|
|
102
95
|
def change_rgb_values(self, r, g, b):
|
|
103
96
|
self.r = r
|
|
104
97
|
self.g = g
|
|
@@ -128,13 +121,14 @@ class Scene:
|
|
|
128
121
|
|
|
129
122
|
def render(self):
|
|
130
123
|
buf = []
|
|
131
|
-
buf.append("\033[
|
|
132
|
-
|
|
124
|
+
buf.append("\033[H")
|
|
125
|
+
buf.append("\033[J")
|
|
126
|
+
|
|
133
127
|
for item in self.items:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
buf.append(f"
|
|
128
|
+
color = f"\033[38;2;{item.r};{item.g};{item.b}m"
|
|
129
|
+
# Standard X, Y positioning
|
|
130
|
+
pos = f"\033[{int(item.y)+1};{int(item.x)+1}H"
|
|
131
|
+
buf.append(f"{pos}{color}{item.text}\033[0m")
|
|
138
132
|
|
|
139
133
|
sys.stdout.write("".join(buf))
|
|
140
134
|
sys.stdout.flush()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|