<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mouse on anotherjesse.com</title><link>https://anotherjesse.com/categories/mouse/</link><description>Recent content in Mouse on anotherjesse.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 05 Nov 2018 00:00:00 +0000</lastBuildDate><atom:link href="https://anotherjesse.com/categories/mouse/index.xml" rel="self" type="application/rss+xml"/><item><title>Mouse Color Worm</title><link>https://anotherjesse.com/sketches/mouse-color-worm/</link><pubDate>Mon, 05 Nov 2018 00:00:00 +0000</pubDate><guid>https://anotherjesse.com/sketches/mouse-color-worm/</guid><description>&lt;p&gt;The worm grows randomly, but the color is based on the mouse position. By using HSB (Hue, Saturation, Brightness) color space, the user can control the color of the worm by moving the mouse.&lt;/p&gt;
&lt;div id="demo"&gt;&lt;/div&gt;
&lt;script src="../p5.min.js"&gt;&lt;/script&gt;
&lt;script src="../addons/p5.dom.min.js"&gt;&lt;/script&gt;
&lt;script src="../addons/p5.sound.min.js"&gt;&lt;/script&gt;
&lt;script src="sketch.js"&gt;&lt;/script&gt;
&lt;p&gt;During setup we need to switch to HSB color space with a maximum value of 1.0 for each component:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f7f7f7;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#1f2328"&gt;colorMode&lt;/span&gt;&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;&lt;span style="color:#1f2328"&gt;HSB&lt;/span&gt;&lt;span style="color:#1f2328"&gt;,&lt;/span&gt; &lt;span style="color:#0550ae"&gt;1.0&lt;/span&gt;&lt;span style="color:#1f2328"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then in the draw function, scale the &lt;code&gt;mouseX&lt;/code&gt; and &lt;code&gt;mouseY&lt;/code&gt; values to set the color of the worm.&lt;/p&gt;</description></item></channel></rss>