This is Scratch Cat on a rotating marble. At the beginning of the programme, a helper sprite scans a three colour version of the Scratch Cat costume and stores values in a list. X-Y-Z rotation angles of the marble are determined by B-splines. https://en.wikipedia.org/wiki/B-spline For every frame that is drawn, all x and y (and z) coordinates of the fixed view are rotated to x' and y', and then these new coordinates are used to look up a colour in the costume list.
This rotating colourful ball uses similar logic: https://scratch.mit.edu/projects/1306126835/