import os
from moviepy.editor import VideoFileClip, ImageClip, TextClip, CompositeVideoClip
from moviepy.video.fx import all as fx
from create_image_with_text import create_image_with_text



def create_final_clip(text_center, main_video_path):
    # Set the size of the final video and other parameters
    size = (1080, 1920)
    delayins = 0 # delay for elements to appear
    fps_size = 60

    # Set the directory where all the files are stored
    dir_path = 'C:/Python/VideoCreationTiktok/Source/'
    dir_path_output = 'C:/Python/VideoCreationTiktok/Output/'

    # Set the paths to the source files
    source_files = ['Background.jpg', 'Frame.png', 'Reaction1.mov', 'tools.png', 'arrow.gif']
    background_path, frame_path, reaction_video_path, tools_path, gif_path = (
    os.path.join(dir_path, file) for file in source_files)

    # Get the length of the main video
    main_video = VideoFileClip(main_video_path)
    main_video_length = main_video.duration

    # Load and resize the background and main video
    background_resized = ImageClip(background_path).resize(height=size[1]).set_position('center')
    main_video_resized = main_video.resize(height=size[1] * 0.73).set_position((60, 40))

    # Load and resize the frame image
    frame_resized = ImageClip(frame_path).resize(height=size[1] * 0.82).set_position((10, 20)).set_duration(
    main_video_length)

    # Load and trim the reaction video
    reaction_video = VideoFileClip(reaction_video_path, has_mask=True).subclip(0, main_video_length)

    # Load and resize the tools image
    tools_resized = ImageClip(tools_path).resize(width=int(size[0] * 0.70)).set_position(('right', 'top'))

    # Add the text to the final clip
    txt_clip = TextClip('All Links', fontsize=tools_resized.h * 0.8, font='Impact', color='white', stroke_width=3,
    stroke_color='black').set_position(('left', 'top')).set_duration(main_video_length)

    # Load and resize the gif file
    gif = VideoFileClip(gif_path, has_mask=True).resize(
    (size[0] - tools_resized.w - txt_clip.w, tools_resized.h)).set_fps(fps_size)
    gif = gif.loop(duration=main_video_length).set_position((txt_clip.size[0], 0))

    # Set the start time for tools, gif, and txt_clip
    tools_resized, gif, txt_clip = (clip.set_start(delayins) for clip in [tools_resized, gif, txt_clip])



    # Create text clip overlay + Resize text_clip_red to 90%
    image_path = create_image_with_text(text_center)
    text_image_red = ImageClip(image_path).set_position(('center', 'center')).set_duration(2).resize(width=int(size[0]*0.9))

   


    

    # Create the final clip
    final_clip = CompositeVideoClip([background_resized, main_video_resized, frame_resized, reaction_video.set_audio(None),
    tools_resized.set_duration(main_video_length), txt_clip, gif, text_image_red], size=size)

    # Apply the 'Summer' color effect and set the audio
    final_clip = fx.lum_contrast(final_clip, lum=0, contrast=0.2, contrast_thr=190).set_audio(main_video.audio)

  

    #REMOVE LATER
    final_clip.duration = 5
    
    #final_clip.duration = main_video_length

    return final_clip

#Testing if works
text_center= "AI CREATES WEBSITES OMG wow wow, omg..."
main_video_path='C:/Python/VideoCreationTiktok/Source/main_video1.mp4'
create_final_clip(text_center, main_video_path).resize(0.5).preview()


I want "text image red" to zoom in and zoom out gradually and smoothly. Write down only the part of code that need to be updated