shekhar98 commited on
Commit
07237f5
·
verified ·
1 Parent(s): fb0f5b6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +138 -3
README.md CHANGED
@@ -1,3 +1,138 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Dataset Description: Manim Code Examples
2
+
3
+ **Overview:**
4
+ This dataset consists of 210 code examples demonstrating the usage of **Manim**, a powerful mathematical animation engine for creating precise and visually appealing animations. Each example is structured as a JSON object containing three key components: a `prompt`, a `response`, and `metadata`. The dataset serves as a comprehensive resource for learning, teaching, or experimenting with Manim's capabilities in animating mathematical concepts, geometric shapes, and other visual elements.
5
+
6
+ ---
7
+
8
+ ### Structure of the Dataset:
9
+
10
+ Each entry in the dataset follows this format:
11
+
12
+ ```json
13
+ {
14
+ "prompt": "A concise description of the task or concept being demonstrated.",
15
+ "response": "The corresponding Python code snippet using Manim to achieve the described task.",
16
+ "metadata": {
17
+ "source": "The URL or reference where the example originates from.",
18
+ "original_name": "The name or identifier of the specific feature or class being demonstrated."
19
+ }
20
+ }
21
+ ```
22
+
23
+ ---
24
+
25
+ ### Key Components:
26
+
27
+ 1. **Prompt (`prompt`)**:
28
+ - A short, descriptive explanation of the animation or feature being showcased.
29
+ - Provides context for the code snippet and helps users understand its purpose.
30
+ - Examples:
31
+ - "Demonstrate how a square's FadeIn animation can be overridden to instead create the shape from scratch."
32
+ - "Show surrounding rectangle and add three texts over it with Succession animation."
33
+
34
+ 2. **Response (`response`)**:
35
+ - A Python code snippet written using the Manim library.
36
+ - Implements the concept or task described in the `prompt`.
37
+ - Includes imports, custom classes (if necessary), and the main animation logic.
38
+ - Examples:
39
+ - Overriding the `FadeIn` animation to use `Create` instead.
40
+ - Animating a group of dots with varying lag ratios and labeling them.
41
+
42
+ 3. **Metadata (`metadata`)**:
43
+ - Contains additional information about the source and context of the example.
44
+ - **Fields**:
45
+ - `source`: The URL or documentation reference where the example is derived from (e.g., Manim's official documentation).
46
+ - `original_name`: The name of the specific feature, class, or method being demonstrated (e.g., `Animation`, `Add`, `FadeIn`).
47
+
48
+ ---
49
+
50
+ ### Example Entries:
51
+
52
+ #### Example 1: Overriding Animation
53
+ ```json
54
+ {
55
+ "prompt": "Demonstrate how a square's FadeIn animation can be overridden to instead create the shape from scratch.",
56
+ "response": "from manim import *\n\nclass MySquare(Square):\n @override_animation(FadeIn)\n def _fade_in_override(self, **kwargs):\n return Create(self, **kwargs)\n\nclass OverrideAnimationExample(Scene):\n def construct(self):\n self.play(FadeIn(MySquare()))",
57
+ "metadata": {
58
+ "source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.html",
59
+ "original_name": "animation"
60
+ }
61
+ }
62
+ ```
63
+
64
+ #### Example 2: Surrounding Rectangle with Succession Animation
65
+ ```json
66
+ {
67
+ "prompt": "Show surrounding rectangle and add three texts over it with Succession animation.",
68
+ "response": "from manim import *\n\nclass DefaultAddScene(Scene):\n def construct(self):\n text_1 = Text(\"I was added with Add!\")\n text_2 = Text(\"Me too!\")\n text_3 = Text(\"And me!\")\n texts = VGroup(text_1, text_2, text_3).arrange(DOWN)\n rect = SurroundingRectangle(texts, buff=0.5)\n\n self.play(\n Create(rect, run_time=3.0),\n Succession(\n Wait(1.0),\n Add(text_1),\n Wait(1.0),\n Add(text_2, text_3),\n ),\n )\n self.wait()",
69
+ "metadata": {
70
+ "source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.Add.html",
71
+ "original_name": "Add"
72
+ }
73
+ }
74
+ ```
75
+
76
+ #### Example 3: Lag Ratios in Dot Animations
77
+ ```json
78
+ {
79
+ "prompt": "Demonstrate the animation of dot groups with varying lag ratios and vertical shifts, displaying corresponding text labels.",
80
+ "response": "from manim import *\n\nclass LagRatios(Scene):\n def construct(self):\n ratios = [0, 0.1, 0.5, 1, 2] # demonstrated lag_ratios\n\n # Create dot groups\n group = VGroup(*[Dot() for _ in range(4)]).arrange_submobjects()\n groups = VGroup(*[group.copy() for _ in ratios]).arrange_submobjects(buff=1)\n self.add(groups)\n\n # Label groups\n self.add(Text(\"lag_ratio = \", font_size=36).next_to(groups, UP, buff=1.5))\n for group, ratio in zip(groups, ratios):\n self.add(Text(str(ratio), font_size=36).next_to(group, UP))\n\n #Animate groups with different lag_ratios\n self.play(AnimationGroup(*[\n group.animate(lag_ratio=ratio, run_time=1.5).shift(DOWN * 2)\n for group, ratio in zip(groups, ratios)\n ]))\n\n # lag_ratio also works recursively on nested submobjects:\n self.play(groups.animate(run_time=1, lag_ratio=0.1).shift(UP * 2))",
81
+ "metadata": {
82
+ "source": "https://docs.manim.community/en/stable/reference/manim.animation.animation.Animation.html",
83
+ "original_name": "Animation"
84
+ }
85
+ }
86
+ ```
87
+
88
+ ---
89
+
90
+ ### Use Cases:
91
+
92
+ 1. **Learning Manim**:
93
+ - Ideal for beginners and intermediate users who want to explore Manim's features through practical examples.
94
+ - Helps users understand how to implement specific animations and customize them.
95
+
96
+ 2. **Teaching and Tutorials**:
97
+ - Can be used by educators to create lesson plans or tutorials on mathematical animations.
98
+
99
+ 3. **Experimentation and Prototyping**:
100
+ - Developers can experiment with the provided code snippets to prototype new animations or modify existing ones.
101
+
102
+ 4. **Documentation and Reference**:
103
+ - Serves as a supplementary resource for Manim's official documentation, offering concrete examples for each feature.
104
+
105
+ ---
106
+
107
+ ### Dataset Highlights:
108
+
109
+ - **Comprehensive Coverage**:
110
+ The dataset includes a wide variety of animations, ranging from basic shape manipulations to advanced techniques like overriding animations and recursive lag ratios.
111
+
112
+ - **Real-World Context**:
113
+ Each example is grounded in a practical use case, making it easier for users to relate the code to real-world applications.
114
+
115
+ - **Traceable Sources**:
116
+ Every example is linked to its original source, ensuring transparency and enabling users to explore further documentation if needed.
117
+
118
+ ---
119
+
120
+ ### Size and Scope:
121
+
122
+ - **Number of Examples**: 210
123
+ - **Primary Library**: Manim
124
+ - **Programming Language**: Python
125
+ - **Topics Covered**:
126
+ - Basic animations (e.g., `FadeIn`, `Create`, `Transform`)
127
+ - Advanced techniques (e.g., overriding animations, lag ratios)
128
+ - Scene construction and customization
129
+ - Text and shape manipulations
130
+
131
+ ---
132
+
133
+ ### Conclusion:
134
+
135
+ This dataset is a valuable resource for anyone interested in mastering Manim or exploring the art of mathematical animations. With its diverse range of examples, clear structure, and traceable sources, it provides a solid foundation for both learning and innovation in the field of animated visualizations.
136
+ ---
137
+ license: mit
138
+ ---