that_one_nigga_you_k

cena até o momento

Jan 6th, 2025
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.24 KB | None | 0 0
  1. from manim import *
  2.  
  3. config.pixel_height = 1920
  4. config.pixel_width = 1080
  5. config.frame_height = 16
  6. config.frame_width = 9
  7. config.frame_rate = 60
  8.  
  9. class sistemaLinear(Scene):
  10.     def construct(self):  
  11.        
  12.        
  13.         sistema = MathTex(r"\left\{ \begin{aligned} &x + y + z = 4 \\ &x^2 + y^2 + z^2 = 14 \\ &x^3 + y^3 + z^3 = 34 \end{aligned} \right.")
  14.         sis = MathTex(r"\left\{ \begin{aligned} &x + y + z = 4 \\ &x^2 + y^2 + z^2 = 14 \\ &x^3 + y^3 + z^3 = 34 \end{aligned} \right.")
  15.         primeiraEq = MathTex(r"x + y + z = 4")
  16.         segundaEq = MathTex(r"x^2 + y^2 + z^2 = 14")
  17.         terceiraEq = MathTex(r"x^3 + y^3 + z^3 = 34")
  18.        
  19.         #primeiro grupo
  20.         primeiraEq2 = MathTex(r"(x + y + z)^2 = 4^2", font_size = 36)
  21.         primeiraEq3 = MathTex(r"x^2 + y^2 + z^2 + 2(xy + yz + xz) = 16", font_size = 36)
  22.         primeiraEq4 = MathTex(r"14 + 2(xy + yz + xz) = 16", font_size = 36)
  23.         primeiraEq5 = MathTex(r"xy + yz + xz = 1", font_size = 36)
  24.        
  25.         #segundo grupo
  26.         primeiraEq6 = MathTex(r"(x + y + z)^3 = 4^3", font_size = 36)
  27.         primeiraEq7 = MathTex(r"x^3 + y^3 + z^3 + 3(x^2(y + z) + y^2(x + z) + z^2(x + y)) + 6xyz = 64", font_size = 26)
  28.         primeiraEq8 = MathTex(r"34 + 3(x^2(y + z) + y^2(x + z) + z^2(x + y)) + 6xyz = 64", font_size = 28)
  29.         primeiraEq9 = MathTex(r"3(x^2(y + z) + y^2(x + z) + z^2(x + y)) + 6xyz = 30", font_size = 30)
  30.        
  31.         #terceiro grupo
  32.         primeiraEq10 = MathTex(r"3(x^2*(4 - x) + y^2(4 - y) + z^2(4 - z)) + 6xyz = 30")
  33.         primeiraEq11 = MathTex(r"3(4x^2 + 4y^2 + 4*z^2) - 3(x^3 + y^3 + z^3) + 6xyz = 30")
  34.         primeiraEq12 = MathTex(r"4x^2 + 4y^2 + 4z^2 - x^3 + y^3 + z^3 + 2xyz = 10")
  35.         primeiraEq13 = MathTex(r"14 - 34 + 2*xyz = 10")
  36.         primeiraEq14 = MathTex(r"xyz = - 6")
  37.        
  38.         grupoEq1 = VGroup(primeiraEq2, primeiraEq3, primeiraEq4, primeiraEq5)
  39.         grupoEq1.arrange(DOWN, aligned_edge=LEFT, buff=0.45)  # ajustando espaçamento e alianhamento
  40.         grupoEq1.to_corner(UL)
  41.  
  42.        
  43.  
  44.         # animar o surgimento
  45.         for i, eq in enumerate(grupoEq1):
  46.            
  47.             self.play(Write(eq))
  48.             self.wait(1)  # ajustar as pausas
  49.            
  50.             if i == 1:
  51.                 #animação pra destacar os elementos ao quadrado
  52.                 #animação pra aparecer o sistema original
  53.                 #desaparece o sistema original
  54.                
  55.                 animacao_quadrados = FadeToColor(primeiraEq3[0][0:8], GOLD, run_time = 1)
  56.                 self.play(animacao_quadrados)
  57.                
  58.                 sistema.move_to(ORIGIN)
  59.                 self.play(Write(sistema), run_time = 1)
  60.        
  61.                 #mudar a cor do 23 ao 33
  62.        
  63.                 mudanca_cor_sistema = FadeToColor(sistema[0][12:20], color= GOLD, run_time = 0.5)
  64.                 reverter_sistema = FadeToColor(sistema[0][12:20], color= WHITE, run_time = 0.5)
  65.        
  66.                 self.play(mudanca_cor_sistema)
  67.                 self.wait(2)
  68.                 self.play(reverter_sistema, Unwrite(sistema),  run_time = 1)
  69.  
  70.             if i == 2:
  71.                 cor_quatorze = FadeToColor(primeiraEq4[0][0:2], GOLD, run_time = 0.15)
  72.                 self.play(cor_quatorze)
  73.  
  74.         num_equacioes = len(grupoEq1)  # ver o total de linhas
  75.         for i in range(num_equacioes - 1):  # iterar até a penultima desaparecer
  76.             self.play(Unwrite(grupoEq1[i]))
  77.             self.wait(1)
  78.  
  79.  
  80.         self.play(primeiraEq5.animate.set_color_by_gradient(RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE).to_corner(UL), run_time=1), #indo pra começo da tela e mudando de cor
  81.        
  82.         grupoEq2 = VGroup(primeiraEq6, primeiraEq7, primeiraEq8, primeiraEq9)
  83.         grupoEq2.arrange(DOWN,aligned_edge=LEFT, buff=0.45)  # ajustando espaçamento e alianhamento
  84.         grupoEq2.next_to(primeiraEq5, DOWN, aligned_edge=LEFT, buff=0.5)
  85.        
  86.         # animar o surgimento
  87.         for i, eq in enumerate(grupoEq2):
  88.             #colorir os termos ao cubo e salientar o xyz
  89.             self.play(Write(eq))
  90.             self.wait(1)  # ajustar as pausas
  91.            
  92.             if i == 1:
  93.                 #colorir as partes ao cubo
  94.                 #mostrar o sistema
  95.                 #colorir o sistema
  96.                 #apagar o sistema
  97.                
  98.                 animacao_cubos = FadeToColor(primeiraEq7[0][0:8], ORANGE, run_time = 1)
  99.                 self.play(animacao_cubos)
  100.                
  101.                
  102.                 sis.move_to(ORIGIN)
  103.                 self.play(Write(sis), run_time = 1)
  104.                
  105.                 mudanca_cor_sistema = FadeToColor(sis[0][23:31], color= ORANGE, run_time = 0.5)
  106.                 reverter_sistema = FadeToColor(sis[0][23:31], color= WHITE, run_time = 0.5)
  107.                
  108.                 self.play(mudanca_cor_sistema)
  109.                 self.wait(2)
  110.                 self.play(reverter_sistema, Unwrite(sis),  run_time = 1)
  111.            
  112.             if i == 2:
  113.                 cor_34 = FadeToColor(primeiraEq8[0][0:2], ORANGE, run_time = 0.15)
  114.                 self.play(cor_34)
  115.                
  116.        
  117.          
  118.         num_equacioes = len(grupoEq2)  # ver o total de linhas
  119.         for i in range(num_equacioes - 1):  # iterar até a penultima desaparecer
  120.             self.play(Unwrite(grupoEq2[i]))
  121.             self.wait(1)
  122.            
  123.         #self.play(primeiraEq9.animate.set_color_by_gradient(PURPLE, ORANGE, YELLOW, GREEN, BLUE, RED).next_to(primeiraEq5, DOWN, aligned_edge=LEFT, buff=0.45)) #indo pra baixo da equação anterior
  124.        
  125.         #primeiraEq9[0][27:31].set_color(GOLD)
  126.        
  127.         color_animation = FadeToColor(primeiraEq9[0][27:31] , color=GOLD, run_time=0.5)
  128.        
  129.         self.play(color_animation)
  130.        
  131.         # Add a pause
  132.         self.wait(2)
  133.        
  134.         self.play(primeiraEq9.animate.next_to(primeiraEq5, DOWN, aligned_edge=LEFT, buff=0.5), run_time = 1)
  135.        
  136.        
  137.        
  138.         self.wait(2)
  139.        
  140.        
  141. class indices(Scene):
  142.     def construct(self):
  143.        
  144.         sistema = MathTex(r"x^3 + y^3 + z^3 + 3(x^2(y + z) + y^2(x + z) + z^2(x + y)) + 6xyz = 64")
  145.        
  146.         self.add(sistema)
  147.         self.add(index_labels(sistema[0], color=RED))
  148.  
Add Comment
Please, Sign In to add comment