from manim import *
import numpy as np
from os import system
import os
from colour import Color
import math
import random

config.media_dir = "E:\PythonMedia\media"
config.frame_width = 16  # 9#16
config.frame_height = 9  # 16#
# config.frame_size = (720,1280)#(3840,2160)#(2560,1440)#(1920,1080)#
config.frame_size = (3840,2160)  ##(3840,2160)#(1280,720)#(3840,2160)#(1280,720)#(1080, 1920) #(1920, 1080) 426 x , 640 x 360,
config.frame_rate = 30
config.background_color = BLACK

class Math_NO2(Scene):
    def construct(self):

        circle = Circle(radius=4, fill_opacity=0, stroke_width=1, stroke_color=ORANGE)
        self.play(FadeIn(circle,run_time=1,rate_func=linear) )
        dotCount = 8
        dotPositions = np.linspace(0,1,dotCount+1)[:dotCount]

        lines = []
        lineVG=VGroup()
        for index in range(dotCount):
            line = Line(start=[0,0,0], end=circle.point_from_proportion(dotPositions[index]),
                        stroke_width=2, stroke_color=ORANGE)
            lines.append(line)

            lineVG.add(line)
        self.play(Create(lineVG, run_time=2,rate_func=linear))

        lineCount = 30
        endPercent = np.linspace(0.99,0.1, lineCount+1)[:lineCount]
        startPercent=np.linspace(0.1,0.99, lineCount+1)[:lineCount]

        lineSingleVG = VGroup()
        for t in range(len(lines)):

            for index in range(lineCount):
                line = Line(start=lines[t].point_from_proportion(startPercent[index]), end=lines[(t+1) % len(lines) ].point_from_proportion(endPercent[index])
                            , stroke_color=ORANGE, stroke_width=1.5)
                #self.add(line)
                lineSingleVG.add(line)
        self.play(Create(lineSingleVG, run_time=20, rate_func=ease_in_circ))
        self.play(FadeOut(circle, run_time=1))
        self.wait(5)



if __name__ == '__main__':
    system("manim -ql {} Math_NO2 --disable_caching".format(__file__))

By Admin

Think-Math Website