Trying to Add Drawing Function to Intro Section
-
Hi!
I'm trying to add in some styling where you can "draw" on the page. I sourced some code but am having a hard time adding it to the specific Intro/header section of the page (when I simply paste the code in without the 'newpageshown' code, it automatically loads on the bottom of every page)
Here's my code so far:
<script> window.laytheme.on("newpageshown", function(layoutObj, type, obj){ if(type == "page" && obj.id == 930){ function setup() { createCanvas(windowWidth, windowHeight); background("#fbf8f3"); document.getElementById("time-block"); } function draw() { if (mouseIsPressed) { pen(); } } function pen() { // set the color and weight of the stroke stroke(0, 0, 0, 255); strokeWeight(2); // draw a line from current mouse point to previous mouse point line(mouseX, mouseY, pmouseX, pmouseY); } </script>
And I have the section on my page as
<div id="time-block"></div>
And as reference, this is the code I'm trying to have featured: https://library.superhi.com/posts/how-to-paint-with-code-creating-paintbrushes <- Under the first section "Drawing a simple line"
Thank you so much if anyone responds! I truly appreciate it. I've been trying to figure it out myself for about 2 hours and can't seem to navigate Java.
TYTY! Going strong with Lay theme <3
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it