ScrollTo() and anchor when viewportLeave another anchor

When the visitor enters the site, I want an animation to play in the centre. Then when they scroll down past the tointro anchor, I want it to scroll to the intro anchor. Then to travel back to the top, I would like it to scroll back to the top when they scroll up past the backtotop anchor. Unfortunately, nothing is responding.

Code is attached and screenshots of the anchors are also attached.

export function tointro_viewportLeave ( event ) {
$w ( ‘#intro’ ). scrollTo ();
}

export function backtotop_viewportEnter ( event ) {
$w ( ‘#anchor1’ ). scrollTo ();
}