I want to change the background color of the stage/canvas upon a certain input, to enunciate a change in the mode that the program is in. Therefore I would like to change the canvas to black when in the different mode and then back to white when the mode is inactive. The background defaults to white.
<canvas id="canvas" width="1500" height="1500">Alternative Content</canvas>
but I imagine I would want to change it with respect to what is in my init function.
var canvas = document.getElementsByTagName('canvas')[0];
canvas.setAttribute('tabindex','0');
canvas.focus();
stage = new createjs.Stage(canvas);
Any ideas how I can change the background color with regards to an input?
You can change the color using JavaScript to set the CSS style.
// Change it to red
canvas.style.backgroundColor = "#ff0000";
// Change it to the value of a text input
canvas.style.backgroundColor = document.getElementById("myTextInput").value;
There is currently no way to do this directly with EaselJS or the Stage.
Hope that helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.