Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.


what it should look like

Loading...

the notebooks will probably not have covered everything you need to know to do this
so, like always: use your favorite search engine

step #1

make the base layout with dummy button and svg area

step #2

draw circles on the base layout using JS (inline script is ok)

step #3

change color and style of painted circle

step #4

animate the color to make transition

step #5

fix the animation to give the desired look

step #6

make the animation stoppable

step #7

make the animation startable/stoppable by pressing the button

step #8

cleanup the code, and cleanup again


a few hints

for example (but that’s entirely up to you)


to create SVG elements in JS

const svgNS = "http://www.w3.org/2000/svg";
let dot = document.createElementNS(svgNS, 'circle');

a possible HTML start

your html part could look like the following

Loading...

how to start on the JS side

class SpinningWheel {
    constructor(svg_element, cx, cy, cr, n_dots, r_dots, period,
                bg_color, fg_color) {
        ...
    }
}

optional assignments

early finishers can :