docs/source/getting_started/whatsnew.rst
There are many changes in the new version of manim, and here are only the changes that may have an impact at the code writing level.
Some of the changes here may not have any major impact on the use, and some changes that affect the use are not mentioned below.
This document is for reference only, see the source code for details.
Animation
Fade as the parent class of FadeIn and FadeOutFadeIn and FadeOut can be passed in shift and scale parametersFadeInFrom, FadeInFromDown, FadeOutAndShift, FadeOutAndShiftDown, FadeInFromLarge, these can be used FadeIn, FadeOut to achieve the same effect more easilyFadeTransform to cross fade between two objects, and subclass FadeTransformPiecesCountInFrom(decimal_mob, source_number=0) to count decimal_mob from source_number to the current valueRotating can directly pass in angle and axis without writing keywords angle=, axis=Rotate has become a subclass of Rotating, and the distortion effect in Transform will not appearMoveCar animationTransformMatchingShapes(mobject, target_mobject) and TransformMatchingTex(mobject, target_mobject)Camera
Removed all camera classes except Camera (MappingCamera, MovingCamera, MultiCamera) and all functions in ThreeDCamera
Implemented CameraFrame (as a Mobject)
self.camera.frame in SceneMobject can be used, such as .shift(), .scale(), etc..to_default_state() to place in the default position.set_euler_angles(theta, phi, gamma).set_theta(theta), .set_phi(phi), .set_gamma(gamma).increment_theta(dtheta), .increment_phi(dphi), .increment_gamma(gamma) to increase the three Euler angles by a certain value. Can be used to realize automatic rotation self.camera.frame.add_updater(lambda mob, dt: mob.increment_theta(0.1 * dt))Camera adds a light source, which is a Point, which can be called by self.camera.light_source in Scene to move and so on. The default position is (- 10, 10, 10)
Delete Container
Mobject
svg related
Checkmark and Exmarkdrawings.pyCode and Paragraph (by mistake)TexMobject is renamed to Tex, TextMobject is renamed to TexTextfont_size has been added to Tex, TexText and TextTex and TexText added isolate, which is a list, which will be automatically splitMobject types
Surface, which is the parent class of ParametricSurface and TexturedSurface.SGroup for SurfaceTexturedSurface(uv_surface, image_file, dark_image_file=None), where uv_surface is a Surface, image_file is the image to be posted, and dark_image_file is the image to be posted in the dark (default and image_file is the same)Mobject1D, Mobject2D, PointCloudDotDotCloud (a PMobject), which has been greatly optimizedAbstractImageMobject, ImageMobjectFromCamerasheen from VMobjectMobject
gloss and shadow, which are the numbers between [0, 1] respectively. There are four methods of .get_gloss(), .set_gloss(gloss), .get_shadow(), .set_shadow(shadow).get_grid(n_rows, n_cols) to copy into grid.set_color_by_code(glsl_code) to use GLSL code to change the color.set_color_by_xyz_func(glsl_snippet, min_value=-5.0, max_value=5.0, colormap="viridis") to pass in GLSL expression in the form of x,y,z, the return value should be a floating point numberCoordinate system (including Axes, ThreeDAxes, NumberPlane, ComplexPlane)
No longer use x_min, x_max, y_min, y_max, but use x_range, y_range as a np.array(), containing three numbers np.array([ Minimum, maximum, step size])
Added the abbreviation .i2gp(x, graph) of .input_to_graph_point(x, graph)
Added some functions of the original GraphScene
.get_v_line(point), .get_h_line(point) to return the line from point to the two coordinate axes, and specify the line type through the keyword argument of line_func (default DashedLine).get_graph_label(graph, label, x, direction, buff, color) to return the label added to the image.get_v_line_to_graph(x, graph), .get_h_line_to_graph(x, graph) to return the line from the point with the abscissa of x on the graph to the two- axis line.angle_of_tangent(x, graph, dx=EPSILON), returns the inclination angle of graph at x.slope_of_tangent(x, graph, dx=EPSILON), returns the slope of tangent line of graph at x.get_tangent_line(x, graph, length=5) to return the tangent line of graph at x.get_riemann_rectangles(graph, x_range, dx, input_sample_type, ...) to return Riemann rectangles (a VGroup)The attribute number_line_config of Axes is renamed to axis_config
Axes original .get_coordinate_labels(x_values, y_values) method was renamed to .add_coordinate_labels(x_values, y_values) (but it is not added to the screen)
.add_coordinate_labels(numbers) of ComplexPlane will directly add the coordinates to the screen
NumberLine
x_min, x_max, tick_frequency, but use x_range, which is an array containing three numbers [min, max, step]label_direction attribute changed to the line_to_number_direction attributetip_width and tip_height with tip_config (dictionary) attributesexclude_zero_from_default attribute is modified to the numbers_to_exclude attribute (default is None).add_tick_marks() method was changed to the .add_ticks() method.get_number_mobjects(*numbers) method, only use the .add_numbers(x_values=None, excluding=None) methodThree-dimensional objects
SurfaceMesh(uv_surface), pass in a Surface to generate its uv meshParametricSurface no longer uses u_min, u_max, v_min, v_max, but instead uses u_range, v_range, which is a tuple ((min, max)), and resolution can be set larger, don’t worry Speed issueTorus, controlled by r1, r2 keyword parametersCylinder, controlled by height, radius keyword parametersLine3D (extremely thin cylinder), controlled by the width keyword parameterDisk3D, controlled by radius keyword parameterSquare3D, controlled by side_length keyword parameterCube and Prism, the usage remains unchangedOther objects
ParametricFunction is renamed to ParametricCurve. Instead of using t_min, t_max, step_size, use t_range, which is an array of three numbers ([t_min, t_max, step_size]). dt was renamed to epsilon. Other usage remains unchangedTipableVMobject can pass in tip_length to control the style of tipLine adds .set_points_by_ends(start, end, buff=0, path_arc=0) methodLine added .get_projection(point) to return the projection position of point on a straight lineArrow adds three attributes of thickness, tip_width_ratio, tip_angleCubicBezier is changed to a0, h0, h1, a1, that is, only a third-order Bezier curve is supportedSquare can be initialized directly by passing in side_length instead of using the keyword side_length=always_redraw(func, *args, **kwargs) supports incoming parameters *args, **kwargsdigit_to_digit_buff property of DecimalNumber has been renamed to digit_buff_per_font_unit, and the .scale() method has been improvedValueTracker adds value_type attribute, the default is np.float64Scene
GraphScene (moved to once_useful_constructs), MovingCameraScene, ReconfigurableScene, SceneFromVideo, ZoomedScene, and ThreeDScene. Because these can basically be achieved by adjusting CameraFrame (self.camera.frame)SampleSpaceScene and VectorScene have not been changed for the new version, so it is not recommended to use (only Scene is recommended)-i option directly.interact() method, during which the mouse and keyboard can be used to continue the interaction, which will be executed by default after the scene ends.embed() method, open iPython terminal to enter interactive mode.save_state() method to save the current state of the scene.restore() method to restore the entire scene to the saved stateutils
utils/bezier.pymatplotlib in utils/color.pyresize_array, resize_preserving_order, resize_with_interpolation three functions have been added to utils/iterables.pysmooth is updated in utils/rate_functions.pyclip(a, min_a, max_a) function has been added to utils/simple_functions.pyutils/space_ops.py, some functions for space calculation, and functions for processing triangulation have been addedconstants
LIGHT_GREY, GREY, DARK_GREY, DARKER_GREY), added a new series of gray GREY_A ~ GREY_E