Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Trying to Add Drawing Function to Intro Section

Trying to Add Drawing Function to Intro Section

Scheduled Pinned Locked Moved General Discussion
2 Posts 1 Posters 128 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H
    H
    hesuhpark
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • H
      H
      hesuhpark
      wrote on last edited by
      #2

      I forgot to mention, I also have this above my code (as provided in the Superhi link)

      <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.3.1/p5.min.js"></script>
      
      1 Reply Last reply
      0

      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
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      Online Users
      Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
      laytheme.com
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Recent
      • Tags
      • Popular
      • Users
      • Search