Saltar al reproductorSaltar al contenido principal
  • hace 2 días
Una orientación vertical, es decir, donde la altura es mayor que el ancho, similar a la forma en que generalmente se sostienen los teléfonos inteligentes. Esto significa que el video tendrá una relación de aspecto de 9:16 o similar, en lugar de la relación de aspecto horizontal (16:9) tradicional.
Este script de Manim, llamado Ondas 6, crea una animación educativa que visualiza las gráficas de las funciones seno y coseno
Observación: en las líneas de código arreglar
-------------------------------------------------------
class Ondas 6(Scene):
def construct(self):
--------------------------------------------------------
Configuración para vista vertical 9:16
altura_actual=config.pixel_height
config.pixel_height=config.pixel_width
config.pixel_width=altura_actual
config.frame_width=config.frame_height * 9/16
FRAME_HEIGHT = config.frame_height
FRAME_WIDTH = config.frame_width
Descargar gratis :
https://www.mediafire.com/file/2qw1fw3e37riwww/codigo+python+manim+2.txt/file
➡ Imagen sistema rectangular en Manim para posicionar objetos :
https://www.mediafire.com/file/3goqai9quuu84qs/Rejilla+manim.png/file

Categoría

📚
Aprendizaje
Transcripción
00:07This video details how to do Python-based programming with the manim library for
00:13Having a vertical video type is a video format in which the height is greater than the width.
00:18generally with an aspect ratio of 9:16, this means that for every 9 units of width
00:25There are 16 units high, in addition to simulating the sine and cosine functions as an example in the
00:32For this programming, we create a folder called wave 5 and open the folder in the environment of
00:38In Visual Studio, we created a file called "waves dot pi" and typed "from a name import asterisk"
00:52This line imports everything necessary from the manim library. The asterisk means import everything that
01:00It allows you to directly use classes and functions from manim such as cn text access number plane raid
01:06create etcetera without having to prefix them with manim we type import mat this line imports the module
01:15The Python `mat` module is fundamental because it provides mathematical functions like `mat` without the `mat` function.
01:21for sine and cosine, which will be used later to draw the graphs, we write
01:29clas onda 6 sen here a class called onda 6 is defined in manim all animations are created within
01:38A class that inherits from sen or scene is the base class that provides the functionality to create and
01:44To manage animations with the def construct self within the wave class, the method is defined.
01:54construct this method is the heart of your animation mani it executes automatically when you generate the
02:02Animation and all operations for creating, moving, and transforming visual objects are written here.
02:10And we get to the important part, the configuration for vertical view 916, we type in the current height underscore
02:18equals config pixel underscore it saves the original height in pixels config pixel underscore it equals
02:26a config pixel underscore assigns the current width value to the height essentially swapping the
02:35dimensions config pixel underscore it equals height underscore current assigns the original height that now
02:42This is the new height to width, this swap of pixel underscore values ​​and pixel underscore values.
02:48It makes the scene render vertically; we write `config frame` underscore, `it` equals `config frame`
02:57underscore it asterisk 9 slash 16 this line adjusts the aspect ratio of the logical frame the
03:04manifold units to match the vertical ratio 9 16
03:11frame underscore it and frame underscore it define the virtual dimensions of the scene, not the pixels.
03:18Here we ensure that the width is 9, the diagonal is 16, and the height is created by creating two lines that assign the values ​​of
03:26config frame underscore it and config frame underscore it to local variables frame underscore it and frame
03:32The underscore is respectively; this is more for convenience for use in later calculations.
03:37without having to write config each time one equals a number plane ad underscore coordinates is created
03:47object number plane a Cartesian plane with grid ad underscore coordinates this additional method makes
03:54The Cartesian plane displays numbers on its axes, which is very useful for visualizing the
03:59coordinates this plan is stored in the variable c1 self watt 1 self watt 1 this line introduces a
04:08A one-second pause in the animation is commonly used to give elements time to appear before
04:14so that the animation continues or so that the viewer assimilates what they see self play pride c1
04:23self play This function is key to animations in Manin; it tells Manin to run an animation
04:31raid c1 is the type of raid animation that makes the object c1 in our Cartesian plane gradually appear.
04:40as if it were being written or drawn self camera background underscore color equal to number sign
04:46282 e 34
04:50The background color of the scene is set by the numeric value 282 e 34, which is a hexadecimal code.
04:58represents a dark gray color commonly used in ec1 code themes equal to text x equal bar
05:05inverse pi 2 asterisk backslash pi color equal to guide move underscore your np array 3,3,0
05:15ec2 equals text x in x color equals guide move underscore your np array underscore 4,3
05:230
05:25ec3 equals text cos x color equals guite move underscore your np array underscore 4,2,0
05:34A text object is created to display text formatted with LaTeX using different vector positions.
05:42We write self play raid ec1 self watt 2, we copy and alternate the variables ec1, ec2 and ec3.
05:54lines animate the appearance of the texts ec1 ec2 and ec3 one by one using the raid animation with
06:00two-second pauses between each appearance so the viewer can read them
06:06We write access equals access x underscore range equals minus 3 6 1 y underscore range equals
06:15at minus 1.5
06:171.5 0.5 x underscore lens equals self camera frame underscore with asterisk 0.8 and
06:27script under lens
06:30asterisk 0.7 axis underscore config equals color gray here an access object is created a system of
06:39axes
06:40coordinates to draw the graphs by adding a color
06:50We write for the sine and cosine functions sine underscore grap equals access plat lambda x mat sin
06:57x x underscore range equals minus 3 6 color equals red
07:021.5 x underscore tim equals 2
07:072.5 x underscore, graph equals 2
07:122.5 x underscore grap equals access plat lambda x mat cos x underscore range equals
07:23minus 3 6 color equals blue
07:26self play and create cosine underscore grab
07:30rond-gar bajo tim igual a 2
07:32self play and create cosine underscore grab
07:35rond-gar bajo tim igual a 2
07:38self wad 1
07:40First, the graph of the sine function is drawn; this will take two seconds. The creation of the graph is animated.
07:46The sine function creates the graph, making it appear to be drawn.
07:50progressively
07:51ROM low time equal to 2, specifies that the creation animation will last 2 seconds, self-watt 0.5, is
08:00After a short pause, similar to the graph of the sine function, the graph of the cosine function is drawn, lambda x, mat,
08:07cos, x defines the function to be graphed, cos, x.
08:11x low range equals, minus 3, 6, the range of x for the graph.
08:17Setting the color to blue sets the graph color to blue.
08:22In the sine function it is red.
08:24Finally, there is a one-second wait for the animation to finish on screen with both graphs visible.
08:30Once the programming is complete, we proceed to compile, but not before verifying some details such as signs, letters, missing words, we select
08:40new terminal and we click.
08:42Before compiling, we write `manin-pql`, which is the video quality, the name of the Python file, and the name of
08:49Our code in this case is wave 6, compiling shows that the programming is correct.
09:08Already in the video, we have the simulation of the functions with their 9, 16, vertical format.
09:25That's all. If you found the video helpful, don't forget to subscribe.
Comentarios

Recomendada