Skip to article frontmatterSkip to article content
tools = require('../js/tools'); tools.init()
Loading...

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 java script (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 stopable

step #7

make the animation startabel/stopable by pressing the button

step #8

cleanup the code, and cleanup again

a few hints

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

also remember that

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

the HTML part

your html part could look like the following

Loading...

observe

observe (2)

so one could offer instead:

SpinningWheel(radius, options) {
   ...
}

and allow callers to set specific parameters in the options object; for examples one could call

let spin = SpinningWheel(100,
                         { bg_color: [200, 100, 50], period=500})

and have the SpinningClass code provide defaults for missing parameters.

optional assignments

early finishers can :