Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Java

Loop Through All Values of Luminance

int dmod = frameCount%510;
int col = dmod<255?dmod:510-dmod;
https://snipt.net/embed/1401a9bebbf0fc3b97bc401abdc003ad/
https://snipt.net/raw/1401a9bebbf0fc3b97bc401abdc003ad/
1401a9bebbf0fc3b97bc401abdc003ad
java
Java
2
2016-12-02T10:30:54
True
False
False
Aug 01, 2013 at 07:40 AM
/api/public/snipt/71174/
loop-through-all-values-of-luminance
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kt">int</span> <span class="n">dmod</span> <span class="o">=</span> <span class="n">frameCount</span><span class="o">%</span><span class="mi">510</span><span class="o">;</span> </span><span id="L-2"><a name="L-2"></a><span class="kt">int</span> <span class="n">col</span> <span class="o">=</span> <span class="n">dmod</span><span class="o">&lt;</span><span class="mi">255</span><span class="o">?</span><span class="n">dmod</span><span class="o">:</span><span class="mi">510</span><span class="o">-</span><span class="n">dmod</span><span class="o">;</span> </span></pre></div> </td></tr></table>
color, processing

Java

Drawing Vertex Shapes with End and Start Being Equal

1
2
3
for (int i=0; i<NUMSEGMENTS+1; i++) {
  drawVertex(i==NUMSEGMENTS?0:i, DIAM_FIXED);
}
https://snipt.net/embed/edc3e587313ce9cb8be8d4fb7d1c5549/
https://snipt.net/raw/edc3e587313ce9cb8be8d4fb7d1c5549/
edc3e587313ce9cb8be8d4fb7d1c5549
java
Java
3
2016-11-25T12:23:17
True
False
False
Aug 01, 2013 at 07:25 AM
/api/public/snipt/71171/
drawing-vertex-shapes-with-end-and-start-being-equal
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="o">;</span> <span class="n">i</span><span class="o">&lt;</span><span class="n">NUMSEGMENTS</span><span class="o">+</span><span class="mi">1</span><span class="o">;</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="n">drawVertex</span><span class="o">(</span><span class="n">i</span><span class="o">==</span><span class="n">NUMSEGMENTS</span><span class="o">?</span><span class="mi">0</span><span class="o">:</span><span class="n">i</span><span class="o">,</span> <span class="n">DIAM_FIXED</span><span class="o">);</span> </span><span id="L-3"><a name="L-3"></a><span class="o">}</span> </span></pre></div> </td></tr></table>
processing

Java

Scroll Through Elements in Array (1 line)

currentImage = ++currentImage%images.length;
https://snipt.net/embed/3efb3b99a7b4f8f79d5d3ef0dcae6056/
https://snipt.net/raw/3efb3b99a7b4f8f79d5d3ef0dcae6056/
3efb3b99a7b4f8f79d5d3ef0dcae6056
java
Java
1
2016-11-29T02:40:32
True
False
False
Aug 01, 2013 at 07:23 AM
/api/public/snipt/71170/
scroll-through-elements-in-array-1-line
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">currentImage</span> <span class="o">=</span> <span class="o">++</span><span class="n">currentImage</span><span class="o">%</span><span class="n">images</span><span class="o">.</span><span class="na">length</span><span class="o">;</span> </span></pre></div> </td></tr></table>
processing
Copyrighted, illegal, or inappropriate content? Email [email protected].