local vector2 = require("#microsoft.xna.framework.vector2")
local exCameraHelper = require("#Celeste.Mod.ExCameraDynamics.Code.Module.ExCameraInterop")

function onBegin()

    disableMovement()
    makeUnskippable ()

    local level = getLevel()
    coroutine.yield(exCameraHelper.Level_ZoomToFocus(level, vector2(2800, 3348), 2, 0.01))
    --coroutine.yield(level:ZoomSnap(vector2(160, 90), 2))

    local darkness = getDarkness ()
    while (true) do
        wait(0.01)
        darkness = darkness - 0.2
        setDarkness (darkness)
        if darkness < 0.2 then
            break
        end
    end

    wait(1)

    player.DummyAutoAnimate = false
    player.Sprite:Play("idleB")

    wait(1)
    
    local darkness = getDarkness ()
    while (true) do
        wait(0.01)
        darkness = darkness + 0.01
        setDarkness (darkness)
        if darkness > 0.99 then
            break
        end
    end

    player.DummyAutoAnimate = true

    teleportTo(3872, 3120, "sunset_A1")

    endCutscene ()
	enableMovement()

end