<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Drawing gradient along a path? Thermometer style gradient?]]></title><description><![CDATA[<p dir="auto">What is the proper way to draw an arc for a knob but apply a thermometer style gradient to it?</p>
<p dir="auto">I want the typical behavior, Colour1 on the lower value of the knob and as the arc progresses it reveals Colour2.</p>
<p dir="auto">I know someone knows what im talking about because Claude doesnt get it and it keeps giving me weird results.</p>
<p dir="auto">See here how it tries to divide the arc up into tiny pieces lmaooo<br />
I can definitely see all the little sections. smh.</p>
<p dir="auto">It looks fine, but Im not happy with the hacky work around. I suspect it'll give me more problems.<br />
If someone can help please. <img src="https://forum.hise.audio/assets/plugins/nodebb-plugin-emoji/emoji/android/1f64f.png?v=fba14f4754a" class="not-responsive emoji emoji-android emoji--pray" style="height:23px;width:auto;vertical-align:middle" title=":pray:" alt="🙏" /></p>
<p dir="auto">Thank you!</p>
<pre><code>    // -- arcBasic --
    var arcBasicW = 0.45 * 2;
    var arcBasicCols = [0xff005EC2, 0xff085BBC, 0xff1058B5, 0xff1955AF, 0xff2152A9, 0xff294FA3, 0xff314C9C, 0xff3A4996, 0xff424690, 0xff4A438A, 0xff524083, 0xff5A3D7D, 0xff633A77, 0xff6B3771, 0xff73346A, 0xff7B3164, 0xff842D5E, 0xff8C2A58, 0xff942751, 0xff9C244B, 0xffA52145, 0xffAD1E3F, 0xffB51B38, 0xffBD1832, 0xffC5152C, 0xffCE1226, 0xffD60F1F, 0xffDE0C19, 0xffE60913, 0xffEF060D, 0xffF70306, 0xffFF0000];
    var arcBasicA0 = -startOffset;
    var arcBasicA1 = endOffset;
    var arcBasicSpan = arcBasicA1 - arcBasicA0;
    for (i = 0; i &lt; 32; i++)
    {
        var ts = i / 32.0;
        var te = (i + 1) / 32.0;
        var sa = arcBasicA0 + arcBasicSpan * ts;
        var ea = arcBasicA0 + arcBasicSpan * te;
        var gT = (sa + startOffset) / totalSweep;
        var ci = Math.floor(gT * 32);
        if (ci &lt; 0) ci = 0;
        if (ci &gt;= 32) ci = 31;
        var Kseg = Content.createPath();
        Kseg.addArc([(1.0-arcBasicW)/2, (1.0-arcBasicW)/2, arcBasicW, arcBasicW], sa, ea);
        var arSeg = Kseg.getBounds(stableSize); arSeg[0]+=ox; arSeg[1]+=oy + stableSize * 0;
        g.setColour(arcBasicCols[ci]);
        var segCap = (i == 0 || i == 31) ? "rounded" : "butt";
        g.drawPath(Kseg, arSeg, {Thickness: stableSize * 0.04, EndCapStyle: segCap, JointStyle: "curved"});
    }
</code></pre>
<p dir="auto">Looks good still but when turning the knob I can see little imperfections which im guessing is from all the cuts in the path.<br />
<img src="/assets/uploads/files/1782258237077-screenshot-2026-06-23-at-4.43.35-pm.png" alt="Screenshot 2026-06-23 at 4.43.35 PM.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="/assets/uploads/files/1782259016181-screenshot-2026-06-23-at-4.56.35-pm.png" alt="Screenshot 2026-06-23 at 4.56.35 PM.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.hise.audio/topic/14875/drawing-gradient-along-a-path-thermometer-style-gradient</link><generator>RSS for Node</generator><lastBuildDate>Wed, 24 Jun 2026 03:12:34 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/14875.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Jun 2026 23:40:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Drawing gradient along a path? Thermometer style gradient? on Wed, 24 Jun 2026 00:55:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/12">@David-Healey</a></p>
<p dir="auto">This works and looks how I expected it should.</p>
<pre><code>    // -- ARC BASIC (gradient) --
    var basW = 0.45 * 2;
    var basR = stableSize * 0.45;
    var Kbas = Content.createPath();
    Kbas.addArc([(1.0-basW)/2, (1.0-basW)/2, basW, basW], -startOffset, endOffset);
    var arBas = Kbas.getBounds(stableSize); arBas[0]+=ox; arBas[1]+=oy + stableSize * 0;
    var gx1 = cx + basR * Math.sin(-startOffset);
    var gy1 = cy - basR * Math.cos(-startOffset) + stableSize * 0;
    var gx2 = cx + basR * Math.sin(startOffset);
    var gy2 = cy - basR * Math.cos(startOffset) + stableSize * 0;
    g.setGradientFill([0xff00D176, gx1, gy1, 0xffFA0085, gx2, gy2, false]);
    g.drawPath(Kbas, arBas, {Thickness: stableSize * 0.05, EndCapStyle: "rounded", JointStyle: "curved"});

</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1782262517188-screenshot-2026-06-23-at-5.54.53-pm.png" alt="Screenshot 2026-06-23 at 5.54.53 PM.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.hise.audio/post/121479</link><guid isPermaLink="true">https://forum.hise.audio/post/121479</guid><dc:creator><![CDATA[Chazrox]]></dc:creator><pubDate>Wed, 24 Jun 2026 00:55:39 GMT</pubDate></item><item><title><![CDATA[Reply to Drawing gradient along a path? Thermometer style gradient? on Tue, 23 Jun 2026 23:58:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/12">@David-Healey</a> I can do gradients on regular panels and flat components.  Im having problems always when dealing with Arcs.  Me math no good. lol</p>
]]></description><link>https://forum.hise.audio/post/121478</link><guid isPermaLink="true">https://forum.hise.audio/post/121478</guid><dc:creator><![CDATA[Chazrox]]></dc:creator><pubDate>Tue, 23 Jun 2026 23:58:20 GMT</pubDate></item><item><title><![CDATA[Reply to Drawing gradient along a path? Thermometer style gradient? on Tue, 23 Jun 2026 23:46:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/4087">@Chazrox</a> I think a radial gradient would work. There should be a video about gradients on my YouTube channel I think, or maybe Patreon</p>
<p dir="auto">Edit: actually a linear gradient might be better</p>
]]></description><link>https://forum.hise.audio/post/121477</link><guid isPermaLink="true">https://forum.hise.audio/post/121477</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Tue, 23 Jun 2026 23:46:32 GMT</pubDate></item></channel></rss>