pikmojicon

Documentation
Login

Documentation

Up one directory

Pikmoji: animals

Tap any pikchr to see its source code.

mouse-01

// By JohnQSmith
// mouse
circle radius 1cm fill black // ear1
move
circle radius 1cm fill black // ear2
C: circle radius 1.6cm at 1.5cm below 1.6cm right of first circle fill black // head
ellipse ht 1.5cm wid 2.5cm at .5cm below C color white fill white // mouth back
ellipse ht 2cm wid 1cm at .3cm above .5cm left of C color white fill white // L eye back
ellipse ht 2cm wid 1cm at .3cm above .5cm right of C color white fill white // R eye back
ellipse ht 1cm wid 2cm at .4cm below C fill black // mouth
ellipse ht 1cm wid 2.2cm at .3cm below C color white fill white // mouth hide
E1: circle radius .3cm at .5cm above .5cm left of C fill black // eye1
circle radius .08cm at .1cm above .1cm right of E1 fill white // eye1hilite
E2: circle radius .3cm at .5cm above .5cm right of C fill black // eye2
circle radius .08cm at .1cm above .1cm right of E2 fill white // eye2hilite
ellipse ht .4cm wid .6cm fill black at .2cm below C // nose

spider-in-web

// Spider in Web - pikchr
// By Ryan Smith: https://pikchr.org/home/forumpost/7711fa2077ecbc34
// Spider in Web - pikchr

CP:   dot;

      $wAngle = 18;                   // Web-Angle (Only works between 0 and 20, else Angle-calcs overflow)
      $spiderScale = 1.5;             // Spider-Scaling factor
      $b = 6.5cm;                     // Beam-Size
      $h = $wAngle;                   // Start loop $h at the Web-Angle

define beam {                         // Macro for drawing radial web beams
      line go $b heading $h thin;
      move to CP;                     // Move back to Center after drawing a beam, then
      $h = $h + 20;                   // Increase beam-angle 20 degrees. 360deg / 20 = 18 beams
}

      beam; beam; beam; beam; beam; beam; beam; beam; beam;  // Draw the 18 beams
      beam; beam; beam; beam; beam; beam; beam; beam; beam;

define rung {                         // Macro for drawing web rungs between beams
      RP: line go $b heading $h thin thin;
      $h = ($h + 20 + $r);            // Increase the angle after every rung, plus a radial offset to
}                                     // cause spiraling towards the end

define webloop {
      $r = 0;
      $b = ($z * 3.14159) / 18;                  // Rung length is rung height (radius) x Pi div by 18 beams
      CS: move go $z heading $wAngle;            // Go up the start beam to the rung radius height
      line from last line.end to CS thin thin;   // Continue the line to there
      $h = $wAngle + 100;                        // 1st rung angle is start angle + half beam angle (10) + 90
      rung; rung; rung; rung; rung; rung; rung; 
      rung; rung; rung; rung; rung; rung;        // Draw first 13 rungs without angle offset ($r)
      $h = $h - 360;                             // Modulo hack (no flow-control and no modulo expression)
      $r = 4 - (4 * $z / 8);                     // Increase angle offset proportional to rung height
      rung; rung; rung; rung; // rung;           // Draw last 4 rungs (no 18th rung so spiral is seamless)
      move to CP;
      $z = $z - 0.25;                            // Set rung-height 1/4cm closer to the center for next rung
}

define leg {                          // Macro for legs, taking 3 "parameters" for the leg-angles
      line from RDT thin chop go $ss*0.8cm heading $1 then go $ss*0.5cm heading $2 then go $ss*0.2cm heading $3;
}

define spider {                       // Macro for drawing a spider
      $ss = $spiderScale;
      BODY: ellipse width $ss*0.3cm height $ss*0.4cm fill black;                    // Body section
      RDT:  ellipse width $ss*0.2cm height $ss*0.2cm fill red at last ellipse.c;    // Red dot (Button spider)
            ellipse width $ss*0.2cm height $ss*0.1cm fill black at RDT.n;           // Mask dot North
            ellipse width $ss*0.2cm height $ss*0.1cm fill black at RDT.s;           // Mask dot South
      HEAD: ellipse with .s at BODY.n width $ss*0.14cm height $ss*0.12cm fill silver;           // Head
            line thin thin from HEAD.nw go $ss*0.08cm heading 155;                  // Attempt at fangs :)
            line thin thin from HEAD.ne go $ss*0.08cm heading 205;
      SPIN: ellipse thin at BODY.s width $ss*0.06cm height $ss*0.08cm;              // Spinner mechanism

      // 4 x Left-side legs
      leg(335, 270, 190);                        // Its questionable if we "need" this to be a macro, since
      leg(303, 229, 190);                        // we draw only 1 spider, and can only draw 1 as the legs
      leg(279, 200, 170);                        // are placed upon web rungs at the specific position.
      leg(265, 190, 150);

      // 4 x Right -side legs
      leg( 40, 109, 190);                        // Use the leg-angle parameters to place legs
      leg( 52, 136, 190);
      leg( 86, 147, 208);
      leg(108, 179, 230);

      SPE: move to SPIN.s;                       // End at the spinner-South so we can connect a web strand to it
}

      // Draw everything
      line up 0;                                        
      $z = 12cm;                                 // Start on outer web spiral loop
      webloop;  webloop;  webloop;  webloop;  webloop;  webloop;  // Draw 18 loops - this qty of loops, the
      webloop;  webloop;  webloop;  webloop;  webloop;  webloop;  // rung-height decrement, and the beam lengths
      webloop;  webloop;  webloop;  webloop;  webloop;  webloop;  // are all inter-dependent.


      move up 1.4cm right 0.1cm                  // Move to the Spider's position, and
      spider;                                    // Draw the spider 

      line thin to RP.end thin;                  // Connect the spider's spinner to the last rung line point.