Q: VPython: Is there anyway to display a canvas before an animation begins? I have been working on a game similar to Angry Birds in which a projectile is launched at a target with the aim of toppling it. However I am struggling to find a way to show the canvas before the initial launch parameters are entered and the animation begins. The first thing that happens when the code is run is that it asks for the inputs but I want to show the visualisation before this happens. Wondering if there was an easy way to do this, the code is below.
scene = canvas(width=640, height=480, center=vector(8,5,0),range=8, background=color.blue)
ground = box(pos=vector(8,-5,0), length=16, height=10, width=0.5, color=color.green)

dist = 5 + random()*10 
target = box(pos=vector(dist,1,0), length=0.5, height=2, width=0.5, color=color.red)

height = random() #determines random height of platform between 0 and 1 meters
platform = box(pos=vector(-2,height-0.25,0), length=4, height=0.5, width=0.5, color=color.white)

bird = sphere(pos=vector(0,height+0.3,0), radius=0.3, color=color.yellow)

hit = 0

while hit == 0: #loops until player hits target

    #Take initial parameters from player
    v0 = float(input('Input your launch velocity:'))
    dtheta = float(input('Input your launch angle in degrees:'))
    theta = np.radians(dtheta) #convert launch angle to radians

    #Draw arrow for initial momentum
    px = 0.1*v0*np.cos(theta) #calculate initial x momentum
    py = 0.1*v0*np.sin(theta) #calculate initial y momentum
    momentum = arrow(pos=bird.pos, axis=vector(px,py,0), shaftwidth=0.1, color=color.orange) #draw arrow representing projectiles initial momentum

    # Calculate position of the projectile at a specified interval of time
    # Code adapted from my submission to PHAS0007: Computing Session 8

    #Define intial parameters
    g = 9.81
    x = x0 = 0
    y = y0 = height 
    dt = 0.0001 #timestep
    t = 0

    #conditions that alllow looping when projectile is not in contact with target
    while (y > 0 and (x < dist-0.25 or x > dist+0.25)) or (y > 2 and x >= dist-0.25 and x<= dist+0.25):

            rate(5000) #set rate of animation

            x = x0 + v0*t*np.cos(theta) # calculate new x position
            y = y0 + v0*t*np.sin(theta)-0.5*g*t**2 # calculate new y position
            bird.pos = vector(x,y,0) # redraw projectile at new position

            px = 0.1*v0*np.cos(theta) #calculate x momentum
            py = 0.1*v0*np.sin(theta)-0.1*g*t #calculate y momentum
            momentum.pos = bird.pos #redraw momentum arrow in new position
            momentum.axis = vector(px,py,0) #redraw momentum arrow direction

            t += dt # increase timestep increment by dt

    momentum.visible = False #removes momentum arrow after projectile motion is finished

    #use inverse condition of the loop to determine and print whether the target was hit or not
    if y >= 0 and y <= 2 and x >= dist-0.25 and x <= dist+0.25:

        #calculate whether the target topples or not
        trest = 0.5*100*g*0.5 #calculate the restoring torque
        contact_t = 0.01 #define the time projectile is in contact with target
        fapp = vector(px, py, 0) / contact_t #calculate applied force of projectile on target
        tapp = cross(fapp, vector((dist+0.25)-x, -y, 0)) #calculate applied torque vector of projectile on target
        tappm = mag(tapp) #calculate magnitude of applied torque vector

        if tappm > trest: #target toppled

            #redraw target to be toppled
            target.pos = vector(dist+1.25,0.25,0)
            target.length = 2
            target.height =0.5
            print('Target toppled, success!')
            hit = 1

        else: #target hit but not toppled
            print('Target hit but not toppled, try again.')

        #animate bird dropping to ground
        t=0 #reset time counter
        y0=y #set y0 equal to current y position
        while y > 0.3:
            rate(5000)
            y = y0 - 0.5*g*t**2            
            bird.pos = vector(x,y,0)
            t += dt

    else:
        print('Target Missed, try again.')

