Y position corresponds to sine of angle. X corresponds to angle. Arrow shows angle. Straight up arrow (+90°) puts Y at maximum position. Down arrow (-90°) puts Y at minimum position. For straight left or right arrow (180° and -180° and 0°) Y = 0. X position corresponds to the angle, from -180 to +180. Works with small amount of code because the constantly rotating arrow-shaped sprite uses its own direction to set its position.
Sprite rotates, as you can see with arrow shape of sprite. That same sprite sets its Y position as sine of its direction, and sets X as the sprite's direction. Because rotation cycles through the angles, it works to continuously make a sine wave, minimizing code. Note: to adjust from the Scratch mode of direction (which is like the compass, with 0 degrees north and running clockwise) to the trigonometric standard (0 degrees facing East, going then counterclockwise), we turn the sprite counterclockwise and then multiply direction in x and y by negative 1, and set arrow facing up for the Scratch default direction of 90 degrees.