<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Exercise 3-7: Continous Line with Varying Thickness</title>
	<atom:link href="http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learningprocessing.com</link>
	<description>A Beginner's Guide to Programming Images, Animation, and Interaction by Daniel Shiffman</description>
	<lastBuildDate>Thu, 09 Feb 2012 16:27:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anonymous</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-20546</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 16 Jun 2011 18:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-20546</guid>
		<description>void setup()
{
  size(600,600);
  background(255);
  smooth();
}

void draw()
{
 stroke (0);
 strokeWeight(sqrt(abs((mouseX-pmouseX))^2 + (abs(mouseY-pmouseY))^2));
 line(pmouseX, pmouseY, mouseX, mouseY); 
}</description>
		<content:encoded><![CDATA[<p>void setup()<br />
{<br />
  size(600,600);<br />
  background(255);<br />
  smooth();<br />
}</p>
<p>void draw()<br />
{<br />
 stroke (0);<br />
 strokeWeight(sqrt(abs((mouseX-pmouseX))^2 + (abs(mouseY-pmouseY))^2));<br />
 line(pmouseX, pmouseY, mouseX, mouseY);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angelozhang</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-20528</link>
		<dc:creator>Angelozhang</dc:creator>
		<pubDate>Fri, 27 May 2011 16:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-20528</guid>
		<description>Hi, here is may code.

void setup(){
size(500,500);
smooth();
stroke(170,230,120);
background(150,10,70);
}

void draw(){
strokeWeight(abs((pmouseX-mouseY)/5));
line(pmouseX,mouseY,mouseX,mouseY);
}</description>
		<content:encoded><![CDATA[<p>Hi, here is may code.</p>
<p>void setup(){<br />
size(500,500);<br />
smooth();<br />
stroke(170,230,120);<br />
background(150,10,70);<br />
}</p>
<p>void draw(){<br />
strokeWeight(abs((pmouseX-mouseY)/5));<br />
line(pmouseX,mouseY,mouseX,mouseY);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maria</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-20484</link>
		<dc:creator>maria</dc:creator>
		<pubDate>Tue, 12 Apr 2011 03:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-20484</guid>
		<description>Well, I practice on different computers and I realize that the very old one, when I used this code without the smooth() the lines of the quad shape would go above the rect shape. But it doesnt happen with my other computers! weird. I am soo passed that now:) My end project for that was this: http://www.openprocessing.org/visuals/?visualID=25799
I am learning so much thanks again!!</description>
		<content:encoded><![CDATA[<p>Well, I practice on different computers and I realize that the very old one, when I used this code without the smooth() the lines of the quad shape would go above the rect shape. But it doesnt happen with my other computers! weird. I am soo passed that now:) My end project for that was this: <a href="http://www.openprocessing.org/visuals/?visualID=25799" rel="nofollow">http://www.openprocessing.org/visuals/?visualID=25799</a><br />
I am learning so much thanks again!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Shiffman</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-20477</link>
		<dc:creator>Daniel Shiffman</dc:creator>
		<pubDate>Fri, 08 Apr 2011 16:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-20477</guid>
		<description>Sorry, I don&#039;t see any difference between having smooth() or not.  What exactly isn&#039;t working?</description>
		<content:encoded><![CDATA[<p>Sorry, I don&#8217;t see any difference between having smooth() or not.  What exactly isn&#8217;t working?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maria</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-20461</link>
		<dc:creator>maria</dc:creator>
		<pubDate>Wed, 30 Mar 2011 21:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-20461</guid>
		<description>Hello,
I am loving the book! I am working on my lesson 1 project now! I am making buildings but when I use the quad() to make the side (to look like perspective) it looks wrong when I use smooth() but not if I don&#039;t use it. What&#039;s going on?Here is my code:

void setup(){
  size(400,200);
  background(104,199,245);
  smooth();
}

void draw(){
 
rectMode(CORNER);
rect(25, 150, 40, 50);//1st building
quad(25, 150, 20, 165, 20, 200, 25, 200);//1st building side 
} 

Thanks!! </description>
		<content:encoded><![CDATA[<p>Hello,<br />
I am loving the book! I am working on my lesson 1 project now! I am making buildings but when I use the quad() to make the side (to look like perspective) it looks wrong when I use smooth() but not if I don&#8217;t use it. What&#8217;s going on?Here is my code:</p>
<p>void setup(){<br />
  size(400,200);<br />
  background(104,199,245);<br />
  smooth();<br />
}</p>
<p>void draw(){</p>
<p>rectMode(CORNER);<br />
rect(25, 150, 40, 50);//1st building<br />
quad(25, 150, 20, 165, 20, 200, 25, 200);//1st building side<br />
} </p>
<p>Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mercedes</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-14986</link>
		<dc:creator>mercedes</dc:creator>
		<pubDate>Mon, 01 Nov 2010 18:22:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-14986</guid>
		<description>first when I WAS DOING IT WITHOUT YHE EXAMPLE ,AS EVERY TIME I STATED TO DRAW A VERY THIK LINE  APPAREAD ,I TOOUGHT I WAS DOING SOMETHING WRONG,BUT COPING AND PASTING HAD THE SAME RESULTS</description>
		<content:encoded><![CDATA[<p>first when I WAS DOING IT WITHOUT YHE EXAMPLE ,AS EVERY TIME I STATED TO DRAW A VERY THIK LINE  APPAREAD ,I TOOUGHT I WAS DOING SOMETHING WRONG,BUT COPING AND PASTING HAD THE SAME RESULTS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: meto</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-9824</link>
		<dc:creator>meto</dc:creator>
		<pubDate>Tue, 09 Mar 2010 19:55:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-9824</guid>
		<description>how about this :
(it seems to work, though i havent really read up the if and else functions)

&lt;pre&gt;
void setup() { 
  size(1000,500);
  background(0);      // line repeating drawing
  smooth();
  stroke(225);
}

void draw() { 
float a = abs(pmouseX-mouseX);  // specifying a variablle to set limits to
  if (a &gt;10)  {                 // limit set
    strokeWeight(50);       // max thickness         
  }   
  else 
  {
      strokeWeight (a);       // variable within limit
  }
  line(pmouseX,pmouseY,mouseX,mouseY);
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>how about this :<br />
(it seems to work, though i havent really read up the if and else functions)</p>
<pre>
void setup() {
  size(1000,500);
  background(0);      // line repeating drawing
  smooth();
  stroke(225);
}

void draw() {
float a = abs(pmouseX-mouseX);  // specifying a variablle to set limits to
  if (a &gt;10)  {                 // limit set
    strokeWeight(50);       // max thickness
  }
  else
  {
      strokeWeight (a);       // variable within limit
  }
  line(pmouseX,pmouseY,mouseX,mouseY);
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nils</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-8037</link>
		<dc:creator>Nils</dc:creator>
		<pubDate>Thu, 31 Dec 2009 20:14:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-8037</guid>
		<description>How about this one?

float thickness = sqrt(sq(pmouseX-mouseX)+sq(pmouseY-mouseY));
strokeWeight(thickness);
line(pmouseX, pmouseY, mouseX, mouseY);

Of course this then can be modified like this to invert the behaviour:
float thickness = 10 / sqrt(sq(pmouseX-mouseX)+sq(pmouseY-mouseY));</description>
		<content:encoded><![CDATA[<p>How about this one?</p>
<p>float thickness = sqrt(sq(pmouseX-mouseX)+sq(pmouseY-mouseY));<br />
strokeWeight(thickness);<br />
line(pmouseX, pmouseY, mouseX, mouseY);</p>
<p>Of course this then can be modified like this to invert the behaviour:<br />
float thickness = 10 / sqrt(sq(pmouseX-mouseX)+sq(pmouseY-mouseY));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-6410</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 02 Nov 2009 18:34:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-6410</guid>
		<description>You can use the map() function to map a range that goes from 0-10 to, say, 10-0.  You can also do this with simple math of course:

int x = 10 - x;

if x is 0, x becomes 10, if x is 2, x becomes 8, etc.

You have to watch out though b/c you can&#039;t have a strokeWeight of less than 0.  Here is some code to start with:

&lt;pre&gt;
  float mouseSpeed = constrain(abs(pmouseX - mouseX),0,20);
  float thickness = map(mouseSpeed,0,20,20,0);
  
  strokeWeight(thickness);
  line(pmouseX, pmouseY, mouseX, mouseY);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>You can use the map() function to map a range that goes from 0-10 to, say, 10-0.  You can also do this with simple math of course:</p>
<p>int x = 10 &#8211; x;</p>
<p>if x is 0, x becomes 10, if x is 2, x becomes 8, etc.</p>
<p>You have to watch out though b/c you can&#8217;t have a strokeWeight of less than 0.  Here is some code to start with:</p>
<pre>
  float mouseSpeed = constrain(abs(pmouseX - mouseX),0,20);
  float thickness = map(mouseSpeed,0,20,20,0);

  strokeWeight(thickness);
  line(pmouseX, pmouseY, mouseX, mouseY);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lalaios</title>
		<link>http://www.learningprocessing.com/exercises/chapter-3/exercise-3-7/comment-page-1/#comment-6352</link>
		<dc:creator>Lalaios</dc:creator>
		<pubDate>Sun, 01 Nov 2009 21:39:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningprocessing.com/?page_id=1112#comment-6352</guid>
		<description>How can someone do the opposite?The slower the mouse moves the wider the  drawn line ?</description>
		<content:encoded><![CDATA[<p>How can someone do the opposite?The slower the mouse moves the wider the  drawn line ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

