Let's include a function that will enable you to create fancy animations later. Add the following function just after your setup( ) function. Examples of how to add visual effects to your trivia game are available in the code examples section, but for now we will simply change the background color.
JavaScript
//Loops continously for background effects and animations. (p5.js)functiondraw(){if (trivia.state=="welcome") background("yellow");elseif (trivia.state=="question") background("lightblue");elseif (trivia.state=="correct") background("green");elseif (trivia.state=="incorrect") background("red");elseif (trivia.state=="thankyou") background("orange");}
You will also need to add the following code to the end of your CSS.