Jul 10, 2017 · 1 min read
Almost exactly yes :)
The main.js code with Vue loads first and creates the UI from a default.php template. The UI is operational rightaway but can’t be used because being the overlay "Welcome to […]".
It also contains the following code (app being my Vue instance):
$(window).one(‘canvas_ready’, function () {
app.settings.canvas_is_ready = true;
});"Loading…" is shown instead of the green button.
I load the sketch js file and at the end of function setup() :
$(window).trigger('canvas_ready');Which shows the big green button to start the app because app.settings.canvas_is_ready becomes true :
<button
v-if="settings.canvas_is_ready"
@click="closeWelcomeScreen">
Let the show begin!
</button>There is no function to modify the canvas in the store, it's all happening in p5.js draw (ie, on requestAnimationFrame). The canvas is looking at the state at all time and compares what's in the canvas and what's in the state.
