Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • 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 53 Views
  • 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 Offline
    H Offline
    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 Offline
      H Offline
      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
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      I also code custom websites or custom Lay features.
      šŸ’æ Email me here: šŸ’æ
      info@laytheme.com

      Before you post:
      1. When using a WordPress Cache plugin, disable it or clear your cache.
      2. Update Lay Theme and all Lay Theme Addons
      3. Disable all Plugins
      4. 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:
      1. Post a link to where the problem is
      2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
      3. If the problem is difficult to explain, post screenshots / link to a video to explain it
      Online Users
      R
      rbr96
      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