<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with setstroke() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=setstroke%28%29</link>
      <pubDate>Sun, 08 Aug 2021 20:15:17 +0000</pubDate>
         <description>Tagged with setstroke() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedsetstroke%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Exporting Sketch to Website using Javascript Mode - Always shows Errors</title>
      <link>https://forum.processing.org/two/discussion/27727/exporting-sketch-to-website-using-javascript-mode-always-shows-errors</link>
      <pubDate>Mon, 09 Apr 2018 18:54:16 +0000</pubDate>
      <dc:creator>borgejor</dc:creator>
      <guid isPermaLink="false">27727@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I am trying to embed my processing sketches on my website using the Javascript Mode. Every time I export however, it comes up with some type of error within the console log and won't load my sketch. The errors I have received on two different sketches are:</p>

<p><strong>VM20:145 Uncaught TypeError: circle.bind is not a function</strong>
    at eval (eval at attach (processing.js:872), :145:17)
    at Processing.Sketch.attach (processing.js:873)
    at executeSketch (processing.js:21501)
    at new Processing.Processing (processing.js:21535)
    at callback (processing.js:950)
    at XMLHttpRequest.xhr.onreadystatechange (processing.js:929)</p>

<p><strong>VM20:29 Uncaught ReferenceError: createShape is not defined</strong>
    at Processing.Processing.setup (eval at attach (processing.js:872), :29:9)
    at executeSketch (processing.js:21508)
    at new Processing.Processing (processing.js:21535)
    at callback (processing.js:950)
    at XMLHttpRequest.xhr.onreadystatechange (processing.js:929)</p>

<p>I had to download the JavaScriptMode from an online source so I am not sure if it will work, but it seems to handle simple sketches just fine. Is it having problems with 2D arrays? or something else I am unaware of.</p>

<p>The code for one of the sketches not working is below:</p>

<p>`    PImage logo;</p>

<pre><code>// Three possible shapes
PShape[] shapes = new PShape[4]; //Pshape array
int shapesize = 100; //shape sizes
int cols = 5;
int rows = 5;
int[][] shapeNumbers;

color[][] colors; //2D color array
color[] colorsb = 
{ 
#F71F02, //red
#13C081, //green
#5BC0EB, //blue
#FDE74C, //yellow
#133C55,
//#FF00FF, //pink
//#FF8000, //orange
};




void setup() {
  size(1920, 1080, P2D);
  ellipseMode(CENTER);
 rectMode(CENTER);
 logo = loadImage("thesis_logo.png");
  shapes[0] = createShape(ELLIPSE,shapesize,shapesize,shapesize,shapesize);
  //shapes[0].setFill(color(255,0,0));
  //shapes[0].setStroke(255);
  shapes[1] = createShape(RECT,shapesize,shapesize,shapesize,shapesize);
  //shapes[1].setFill(color(0));
  //shapes[1].setStroke(255);
  shapeMode(CENTER);
  shapes[2] = createShape();  
  shapes[2].beginShape();
 //shapes[2].fill(0); //fill squares
 // shapes[2].setStroke(255);
   shapes[2].vertex(-14+shapesize, -20+shapesize);
   shapes[2].vertex(-47+shapesize, -15+shapesize);
   shapes[2].vertex(-23+shapesize, 7+shapesize);
   shapes[2].vertex(-29+shapesize, 40+shapesize);
   shapes[2].vertex(0+shapesize, 25+shapesize);
    shapes[2].vertex(29+shapesize, 40+shapesize);
    shapes[2].vertex(23+shapesize, 7+shapesize);
    shapes[2].vertex(47+shapesize, -15+shapesize);
     shapes[2].vertex(14+shapesize, -20+shapesize);
  shapes[2].vertex(0+shapesize, -50+shapesize);
  shapes[2].endShape(CLOSE);

   shapes[3] = createShape(TRIANGLE,30, 75, 58, 20, 86, 75);  


shapeNumbers = new int[rows][cols];
 colors();
mix();
}




void draw() {
  background(255);
 shapes(150,150);
  image(logo, 50, 50, width/8, height/8);



 if (keyPressed) {
      if(key==ENTER){
       mix();
       colors();
      }
    }
}

void shapes(int posx, int posy){
 pushMatrix();
  translate(width/3,200);
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

      int shapeIndex = shapeNumbers[i][j];
PShape currentShape = shapes[shapeIndex];
     currentShape.setFill(colors[i][j]);
     currentShape.setStroke(false);
    shape(currentShape,i*posx,j*posy,shapesize,shapesize);

    if (mousePressed ==true){
      int x = i*posx+width/3;
      int y = j*posy+200;
     if (mouseX &gt; x &amp;&amp; mouseX &lt; (x + shapesize) &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; (y + shapesize)){
      colors[i][j]=color(255);
    }
    }
    }
  }
    popMatrix();
}

void mix(){
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

    shapeNumbers[i][j] = int(random(shapes.length));

    }}
}

void colors(){
  colors = new color[cols][rows];
  for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {
      int rand = (int)random(colorsb.length); //choose a random value in array
      colors[i][j] = color(colorsb[rand]); //random color from array
    }
  }
}`
</code></pre>
]]></description>
   </item>
   <item>
      <title>[SOLVED] How to use variables from one function in another, when variables were ...</title>
      <link>https://forum.processing.org/two/discussion/27717/solved-how-to-use-variables-from-one-function-in-another-when-variables-were</link>
      <pubDate>Sat, 07 Apr 2018 18:07:27 +0000</pubDate>
      <dc:creator>borgejor</dc:creator>
      <guid isPermaLink="false">27717@/two/discussions</guid>
      <description><![CDATA[<p>I am not very skilled in Processing, but I have been trying to convert my sketch from mouse clicks to using Kinect hand states. How do I use variables from function1 in function2, when the variables were declared using function1's arguments?</p>

<pre><code>void shapes(int posx, int posy)
{
 pushMatrix();
translate(width/3,200);
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

      int shapeIndex = shapeNumbers[i][j];
      PShape currentShape = shapes[shapeIndex];
     currentShape.setFill(colors[i][j]);
     currentShape.setStroke(false);
     shape(currentShape,i*posx,j*posy,shapesize,shapesize);

    if (mousePressed ==true){
    int  x = i*posx+width/3;
     int y = j*posy+200;
     if (mouseX &gt; x &amp;&amp; mouseX &lt; (x + shapesize) &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; (y + shapesize)){
      colors[i][j]=color(255);
    }
    }
    }
  }
    popMatrix();
}

void shapes(int posx, int posy){
 pushMatrix();
  translate(width/3,200);
 for (int i=0; i&lt;cols; i++) {
    for (int j=0; j&lt;rows; j++) {

      int shapeIndex = shapeNumbers[i][j];
PShape currentShape = shapes[shapeIndex];
     currentShape.setFill(colors[i][j]);
     currentShape.setStroke(false);
    shape(currentShape,i*posx,j*posy,shapesize,shapesize);

    if (mousePressed ==true){
    int  x = i*posx+width/3;
     int y = j*posy+200;
     if (mouseX &gt; x &amp;&amp; mouseX &lt; (x + shapesize) &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; (y + shapesize)){
      colors[i][j]=color(255);
    }
    }
    }
  }
    popMatrix();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Convert a String to a Hexidecimal</title>
      <link>https://forum.processing.org/two/discussion/23953/convert-a-string-to-a-hexidecimal</link>
      <pubDate>Mon, 28 Aug 2017 18:45:39 +0000</pubDate>
      <dc:creator>Tallen121</dc:creator>
      <guid isPermaLink="false">23953@/two/discussions</guid>
      <description><![CDATA[<p>So I have an excel spreadsheet with "6ef442", I load the string and put it into classColor[0],  then here's where things get really stupid:</p>

<p>Tab1:</p>

<p><code>newEvent.coloring(classColor[0]);</code></p>

<p>Tab2:</p>

<p><code>void coloring(String chosen) {
   classColor = unhex(chosen);
}</code></p>

<p><code>void draw() {
   eventColor = createShape(RECT, 0, 0, 40, 40);
   eventColor.setFill(classColor);
   eventColor.setStroke(false);
}</code></p>

<p>No matter what obscure type of code I try, I cannot get that rectangle to turn 6ef442. Just... Help. If you know how to improve my ridiculous code or if you know how to get just my stupid rectangle to be the color I want it to be. I appreciate it a ton. Thank</p>
]]></description>
   </item>
   <item>
      <title>PShape OBJ.setStroke</title>
      <link>https://forum.processing.org/two/discussion/15866/pshape-obj-setstroke</link>
      <pubDate>Tue, 05 Apr 2016 20:19:24 +0000</pubDate>
      <dc:creator>noamnav</dc:creator>
      <guid isPermaLink="false">15866@/two/discussions</guid>
      <description><![CDATA[<p>hello all,</p>

<p>i'm trying to set the stroke of an imported obj file i'm importing into the drawing with no success. funnily, the setFill() function works just fine.</p>

<p>at the moment, the setStroke() function has no effect on the drawing.</p>

<p>suggestions?</p>

<p>thanks</p>

<pre><code>PShape p;

void setup() {
  size (500, 500, P3D);
  p = loadShape("poly.obj");
  p.setFill(color(150, 0, 0, 100));
  p.setStrokeWeight(10);
  p.setStroke(color(0));
} 

void draw() {
  background(214);
  shape(p, 0, 0);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to change the color of one triangle in a PShape? (TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP...)</title>
      <link>https://forum.processing.org/two/discussion/19317/how-to-change-the-color-of-one-triangle-in-a-pshape-triangles-triangle-fan-triangle-strip</link>
      <pubDate>Sat, 26 Nov 2016 19:55:12 +0000</pubDate>
      <dc:creator>AKK</dc:creator>
      <guid isPermaLink="false">19317@/two/discussions</guid>
      <description><![CDATA[<p>In processing there is this cool tool called PShape that if you don't know about, you should learn, it is extremly powerful when it comes to complicated graphics (3d graphics in my case), and makes even unthinkable concepts managable.
But I ran into a problem with it, processing provides a variaty of cool built-in shapes you can use, in my case things like triangle fans, triangle strips, and just a bunch of triangles, but they lack some functionality I wish it had, changing single triangle colors.
When you use a GROUP shape it can have many children shapes which consist of it, and the best part is you still can use each child as an individual shape, and you would think triangle strips and fans should be the same, it is a big shape made from many little triangles, so I should be able to control each triangle individually, and to some level it is, you can get how many vertices make the shape, and even move them, but when it comes to color you can control only the color of the entire shape, and not each triangle by itself.
Is there any way around this? Can I somehow change the color of a single triangle without the rest in a built-in shape?</p>
]]></description>
   </item>
   <item>
      <title>Get stroke color of svg drawing</title>
      <link>https://forum.processing.org/two/discussion/18979/get-stroke-color-of-svg-drawing</link>
      <pubDate>Fri, 11 Nov 2016 02:42:35 +0000</pubDate>
      <dc:creator>royal_orchestra</dc:creator>
      <guid isPermaLink="false">18979@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I'm trying to animate a line drawing. 
This article helped me to do it:
<a href="https://forum.processing.org/one/topic/make-a-dot-follow-a-svg-path.html" target="_blank" rel="nofollow">https://forum.processing.org/one/topic/make-a-dot-follow-a-svg-path.html</a>
But - I have an SVG with strokes in different colors. How can I read it so the  slowly painted image looks like the sourcefile in the end? (The draw order or z-index is also interesting. )
I could not find any explanation how to get and use the stroke-color with geomerative anywhere.
Best regards
Jens</p>
]]></description>
   </item>
   </channel>
</rss>