Challenge: 
Version: 
4
Winner?: 
No
Code Snippet: 
sync on : sync rate 0
hide mouse

`Constants
#constant nr = 1
#constant Trails = 100
#constant St = 5
#constant col = rgb(0, 128, 255)

`Arrays
type pos
    x as integer
    y as integer
endtype
dim T(1, Trails) as pos
dim S(1) as integer

do

    cls

    `Update first trail point
    T(1, 1).x = mousex()
    T(1, 1).y = mousey()

    `update trails
    UpdateTrails(1)

    sync
loop

function UpdateTrails(n)

    `If the trail has to update itself
    if timer() - S(n) > St
    
        `Reset timer
        S(n) = timer()

        `Update all trails
        for t = Trails to 2 step -1
        
            `Copy the x and y coordinates of its parent trail point
            T(1, t).x = T(1, t - 1).x
            T(1, t).y = T(1, t - 1).y
            
        next t
    endif

    `Draw all trail parts
    for t = 2 to Trails
    
        `Calculate appropriate color for the fading effect
        f# = 0.1 * Trails * 10.0 / (Trails - t)
        tcol = rgb( rgbr(col) / f#, rgbg(col) / f#, rgbb(col) / f#)
        ink tcol, 0
        
        `Connect it with its parent
        line T(1, t).x, T(1, t).y, T(1, t - 1).x, T(1, t - 1).y
    next t


endfunction