Create Unit Circle with its Sin Cos Animation

I read this:

I know the MiniFB needs a browser, I use dual boot OS, one(LFS OS) has no browser thus has a problem with MiniFB, one (CAELinux) has standard browser firefox thus can use Pluto.jl and can show the visual window like yours for the simulation.

I just want to show the result without browser, not depending much on browser. Julia REPL and Plots shall be enough. I will try to convert your code from @play

Btw, I try this code and the gif is not showing up:

using Luxor, MiniFB
if !(@isdefined var"@play")
    include(dirname(pathof(Luxor)) * "/play.jl")
end

let
    w, h = 600, 400

    ntrig = 360
    sinarray = sind.(1:ntrig)
    cosarray = cosd.(1:ntrig)
    i = 1

    @play w h begin
        background("gray"); sethue("white")

        # translate near bottom right corner
        origin(0.8w, 0.8h)
        setline(1); setopacity(1)
        cr = 0.15h
        circle(0, 0, cr, :stroke)
        circle_marker_pos = getworldposition(Point(cr*cosarray[i], cr*sinarray[i]))

        # translate to lower 20%, on the left
        origin(0, 0.8h)
        setline(1); setopacity(1)
        scale(1.0, cr)
        # draw a sin wave
        for j in 1:ntrig-1
            p1 = Point(j, sinarray[mod(j+i, ntrig)+1])
            p2 = Point((j+1), sinarray[mod(j+i+1, ntrig)+1])
            line(p1, p2, :stroke)
        end
        # record the last point of the sin wave
        sin_marker_pos = getworldposition(Point(ntrig,sinarray[mod(ntrig+i, ntrig)+1]))

        # translate to top left corner, then down 20%
        origin(0, 0.2h)
        scale(1.0, cr)
        setline(1); setopacity(1)
        # draw a sin wave
        for j in 1:ntrig-1
            p1 = Point(j, cosarray[mod(j+i, ntrig)+1])
            p2 = Point((j+1), cosarray[mod(j+i+1, ntrig)+1])
            line(p1, p2, :stroke)
        end
        # record the last point of the sin wave
        cos_marker_pos = getworldposition(Point(ntrig, cosarray[mod(ntrig+i, ntrig)+1]))

        # mark the last point of the sin and cos waves
        origin()
        setline(2); setopacity(1);
        circle(sin_marker_pos, 2, :stroke)
        circle(cos_marker_pos, 2, :stroke)
        circle(circle_marker_pos, 2, :stroke)
        # draw connecting lines between the wave and the circle
        setline(1); setopacity(0.5)
        line(sin_marker_pos, circle_marker_pos, :stroke)
        # line(cos_marker_pos, circle_marker_pos, :stroke)

        i %= ntrig
        i += 1
    end
end

begin
function frame(scene, i)
movie = Movie(600, 400, "Lasthrim")
animate(movie, [Scene(demo, frame, 0:359)], creategif=true, pathname = "sincoscircleluxor.gif")
end