Hey, I’m trying to use the createRadio() function, but I get this error:
Uncaught ReferenceError: createRadio is not defined
at setup (p5js-temp-sketch_220402a1584838079584472986.js:4:3)
at m.<anonymous> (p5.min.js:3:230028)
at m.<anonymous> (p5.min.js:3:229048)
at new m (p5.min.js:3:232427)
at n (p5.min.js:3:226962)
my code:
let radio;
function setup() {
radio = createRadio();
radio.option('black');
radio.option('white');
radio.option('gray');
radio.style('width', '60px');
textAlign(CENTER);
fill(255, 0, 0);
}
function draw() {
let val = radio.value();
background(val);
text(val, width / 2, height / 2);
}
HTML file:
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- PLEASE NO CHANGES BELOW THIS LINE (UNTIL I SAY SO) -->
<script language="javascript" type="text/javascript" src="libraries/p5.min.js"></script>
<script language="javascript" type="text/javascript" src="p5js-temp-sketch_220402a1584838079584472986.js"></script>
<!-- OK, YOU CAN MAKE CHANGES BELOW THIS LINE AGAIN -->
<!-- This line removes any default padding and style.
You might only need one of these values set. -->
<style> body { padding: 0; margin: 0; } </style>
</head>
<body>
</body>
</html>
Do you have any idea?
Thanks