raksama19 commited on
Commit
7a7ed4b
·
verified ·
1 Parent(s): 387f188

12th commit

Browse files
Files changed (1) hide show
  1. app.py +66 -3
app.py CHANGED
@@ -302,7 +302,72 @@ class SimpleMath(Scene):
302
  self.play(Write(text1))
303
  self.wait()
304
  self.play(Transform(text1, text2))
305
- self.wait()'''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
 
308
  def check_system_requirements():
@@ -491,8 +556,6 @@ with gr.Blocks(title="Manim Animation Generator", theme=gr.themes.Soft()) as app
491
  - **Animations**: `Create()`, `Write()`, `Transform()`, `FadeIn()`, `FadeOut()`
492
  - **Colors**: `RED`, `BLUE`, `GREEN`, `YELLOW`, `WHITE`, `BLACK`
493
 
494
- ```
495
-
496
  ---
497
  Made with ❤️ using [Manim](https://www.manim.community/) and [Gradio](https://gradio.app/)
498
  """)
 
302
  self.play(Write(text1))
303
  self.wait()
304
  self.play(Transform(text1, text2))
305
+ self.wait()''',
306
+
307
+ "Polynomial Plot": '''from manim import *
308
+ import numpy as np
309
+
310
+ class PolynomialPlot(Scene):
311
+ def construct(self):
312
+ # Set up the coordinate system
313
+ axes = Axes(
314
+ x_range=[-4, 4, 1],
315
+ y_range=[-20, 80, 10],
316
+ x_length=10,
317
+ y_length=6,
318
+ axis_config={"color": BLUE},
319
+ x_axis_config={
320
+ "numbers_to_include": np.arange(-4, 5, 1),
321
+ "numbers_with_elongated_ticks": np.arange(-4, 5, 1),
322
+ },
323
+ y_axis_config={
324
+ "numbers_to_include": np.arange(-20, 81, 20),
325
+ "numbers_with_elongated_ticks": np.arange(-20, 81, 20),
326
+ },
327
+ tips=False,
328
+ )
329
+
330
+ # Add axis labels
331
+ axes_labels = axes.get_axis_labels(x_label="x", y_label="f(x)")
332
+
333
+ # Define the polynomial function
334
+ def polynomial(x):
335
+ return x**3 - 2*x**2 + 10*x + 8
336
+
337
+ # Create the polynomial graph
338
+ graph = axes.plot(polynomial, color=RED, x_range=[-4, 4])
339
+
340
+ # Create the function label
341
+ function_label = MathTex(r"f(x) = x^3 - 2x^2 + 10x + 8", color=RED)
342
+ function_label.to_corner(UP + LEFT)
343
+
344
+ # Animation sequence
345
+ # First, show the axes
346
+ self.play(Create(axes), Write(axes_labels), run_time=2)
347
+
348
+ # Show the function label
349
+ self.play(Write(function_label), run_time=1)
350
+
351
+ # Animate the drawing of the polynomial curve
352
+ self.play(Create(graph), run_time=6)
353
+
354
+ # Hold the final scene
355
+ self.wait(1)
356
+
357
+ # Optional: Add some points of interest
358
+ # Find and mark the y-intercept (when x=0)
359
+ y_intercept_point = axes.coords_to_point(0, polynomial(0))
360
+ y_intercept_dot = Dot(y_intercept_point, color=YELLOW, radius=0.08)
361
+ y_intercept_label = MathTex(r"(0, 8)", color=YELLOW).next_to(y_intercept_dot, RIGHT)
362
+
363
+ self.play(
364
+ Create(y_intercept_dot),
365
+ Write(y_intercept_label),
366
+ run_time=0.5
367
+ )
368
+
369
+ # Final wait to complete 10 seconds total
370
+ self.wait(0.5)'''
371
  }
372
 
373
  def check_system_requirements():
 
556
  - **Animations**: `Create()`, `Write()`, `Transform()`, `FadeIn()`, `FadeOut()`
557
  - **Colors**: `RED`, `BLUE`, `GREEN`, `YELLOW`, `WHITE`, `BLACK`
558
 
 
 
559
  ---
560
  Made with ❤️ using [Manim](https://www.manim.community/) and [Gradio](https://gradio.app/)
561
  """)