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
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login