<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: animation</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/animation.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2025-02-04T20:53:29+00:00</updated><author><name>Simon Willison</name></author><entry><title>Animating Rick and Morty One Pixel at a Time</title><link href="https://simonwillison.net/2025/Feb/4/animating-rick-and-morty-one-pixel-at-a-time/#atom-tag" rel="alternate"/><published>2025-02-04T20:53:29+00:00</published><updated>2025-02-04T20:53:29+00:00</updated><id>https://simonwillison.net/2025/Feb/4/animating-rick-and-morty-one-pixel-at-a-time/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://danielchasehooper.com/posts/code-animated-rick/"&gt;Animating Rick and Morty One Pixel at a Time&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Daniel Hooper says he spent 8 months working on the post, the culmination of which is an animation of Rick from Rick and Morty, implemented in 240 lines of GLSL - the OpenGL Shading Language which apparently has been directly supported by browsers for many years.&lt;/p&gt;
&lt;p&gt;The result is a comprehensive GLSL tutorial, complete with interactive examples of each of the steps used to generate the final animation which you can tinker with directly on the page. It feels a bit like Logo!&lt;/p&gt;
&lt;p&gt;&lt;img alt="Animated demo - as I edit the shader code Rick's half-drawn eye pupils move from side to side live with my edits" src="https://static.simonwillison.net/static/2025/rick-edit.gif" /&gt;&lt;/p&gt;
&lt;p&gt;Shaders work by running code for each pixel to return that pixel's color - in this case the &lt;code&gt;color_for_pixel()&lt;/code&gt; function is wired up as the core logic of the shader.&lt;/p&gt;
&lt;p&gt;Here's &lt;a href="https://gist.github.com/danielchasehooper/72da5d9c286e5e94fdfb8e82bea288cc"&gt;Daniel's code for the live shader editor&lt;/a&gt; he built for this post. It looks like &lt;a href="https://gist.github.com/danielchasehooper/72da5d9c286e5e94fdfb8e82bea288cc#file-inline_shader-js-L47-L60"&gt;this&lt;/a&gt; is the function that does the most important work:&lt;/p&gt;
&lt;div class="highlight highlight-source-js"&gt;&lt;pre&gt;&lt;span class="pl-k"&gt;function&lt;/span&gt; &lt;span class="pl-en"&gt;loadShader&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s1"&gt;shaderSource&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt; &lt;span class="pl-s1"&gt;shaderType&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
    &lt;span class="pl-k"&gt;const&lt;/span&gt; &lt;span class="pl-s1"&gt;shader&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s1"&gt;gl&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-en"&gt;createShader&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s1"&gt;shaderType&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
    &lt;span class="pl-s1"&gt;gl&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-en"&gt;shaderSource&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s1"&gt;shader&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt; &lt;span class="pl-s1"&gt;shaderSource&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
    &lt;span class="pl-s1"&gt;gl&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-en"&gt;compileShader&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s1"&gt;shader&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
    &lt;span class="pl-k"&gt;const&lt;/span&gt; &lt;span class="pl-s1"&gt;compiled&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s1"&gt;gl&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-en"&gt;getShaderParameter&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s1"&gt;shader&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt; &lt;span class="pl-s1"&gt;gl&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-c1"&gt;COMPILE_STATUS&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
    &lt;span class="pl-k"&gt;if&lt;/span&gt; &lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-c1"&gt;!&lt;/span&gt;&lt;span class="pl-s1"&gt;compiled&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
        &lt;span class="pl-k"&gt;const&lt;/span&gt; &lt;span class="pl-s1"&gt;lastError&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s1"&gt;gl&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-en"&gt;getShaderInfoLog&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s1"&gt;shader&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
        &lt;span class="pl-s1"&gt;gl&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-en"&gt;deleteShader&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s1"&gt;shader&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
        &lt;span class="pl-k"&gt;return&lt;/span&gt; &lt;span class="pl-s1"&gt;lastError&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
    &lt;span class="pl-kos"&gt;}&lt;/span&gt;
    &lt;span class="pl-k"&gt;return&lt;/span&gt; &lt;span class="pl-s1"&gt;shader&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
&lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Where &lt;code&gt;gl&lt;/code&gt; is a &lt;code&gt;canvas.getContext("webgl2")&lt;/code&gt; &lt;code&gt;WebGL2RenderingContext&lt;/code&gt; object, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext"&gt;described by MDN here&lt;/a&gt;.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://lobste.rs/s/ycbpnz/animating_rick_morty_one_pixel_at_time"&gt;lobste.rs&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/canvas"&gt;canvas&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/webgl"&gt;webgl&lt;/a&gt;&lt;/p&gt;



</summary><category term="animation"/><category term="canvas"/><category term="javascript"/><category term="webgl"/></entry><entry><title>Pure CSS3 Spiderman Cartoon w/ jQuery and HTML5</title><link href="https://simonwillison.net/2010/May/4/animation/#atom-tag" rel="alternate"/><published>2010-05-04T19:27:00+00:00</published><updated>2010-05-04T19:27:00+00:00</updated><id>https://simonwillison.net/2010/May/4/animation/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.optimum7.com/internet-marketing/web-development/pure-css3-spiderman-ipad-cartoon-jquery-html5-no-flash.html"&gt;Pure CSS3 Spiderman Cartoon w/ jQuery and HTML5&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Great demo, though calling -webkit-animation HTML5 (or even CSS3) is a bit of a stretch...


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/css3"&gt;css3&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/html5"&gt;html5&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jquery"&gt;jquery&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/recovered"&gt;recovered&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/webkitanimation"&gt;webkitanimation&lt;/a&gt;&lt;/p&gt;



</summary><category term="animation"/><category term="css"/><category term="css3"/><category term="html5"/><category term="javascript"/><category term="jquery"/><category term="recovered"/><category term="webkitanimation"/></entry><entry><title>Going Nuts with CSS Transitions</title><link href="https://simonwillison.net/2009/Dec/14/transitions/#atom-tag" rel="alternate"/><published>2009-12-14T13:16:34+00:00</published><updated>2009-12-14T13:16:34+00:00</updated><id>https://simonwillison.net/2009/Dec/14/transitions/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://24ways.org/2009/going-nuts-with-css-transitions"&gt;Going Nuts with CSS Transitions&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Nat’s article for this year’s 24ways—adding special effects to images using CSS rotation, box shadows and the magical -webkit-transition property.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/24-ways"&gt;24-ways&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/natalie-downe"&gt;natalie-downe&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/rotation"&gt;rotation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/webkit"&gt;webkit&lt;/a&gt;&lt;/p&gt;



</summary><category term="24-ways"/><category term="animation"/><category term="css"/><category term="natalie-downe"/><category term="rotation"/><category term="webkit"/></entry><entry><title>"I made the first animated under construction icon"</title><link href="https://simonwillison.net/2009/Oct/15/twoleftfeet/#atom-tag" rel="alternate"/><published>2009-10-15T14:11:53+00:00</published><updated>2009-10-15T14:11:53+00:00</updated><id>https://simonwillison.net/2009/Oct/15/twoleftfeet/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.metafilter.com/85695/Please-Be-Patient-This-Page-is-Under-Construction#2774563"&gt;&amp;quot;I made the first animated under construction icon&amp;quot;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
twoleftfeet on MetaFilter describes how he created the first ever Under Construction animation in 1995, after discovering his server-push animations could be replaced by the exciting new animated GIF.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/gifs"&gt;gifs&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/history"&gt;history&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/internet-history"&gt;internet-history&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/metafilter"&gt;metafilter&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/underconstruction"&gt;underconstruction&lt;/a&gt;&lt;/p&gt;



</summary><category term="animation"/><category term="gifs"/><category term="history"/><category term="internet-history"/><category term="metafilter"/><category term="underconstruction"/></entry><entry><title>jQuery queue method</title><link href="https://simonwillison.net/2009/Jan/14/corequeue/#atom-tag" rel="alternate"/><published>2009-01-14T18:09:22+00:00</published><updated>2009-01-14T18:09:22+00:00</updated><id>https://simonwillison.net/2009/Jan/14/corequeue/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://docs.jquery.com/Core/queue"&gt;jQuery queue method&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
New in jQuery 1.3, but quite far down the release notes. This finally allows low-level control over the jQuery animation queue without needing an extra plugin.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jquery"&gt;jquery&lt;/a&gt;&lt;/p&gt;



</summary><category term="animation"/><category term="jquery"/></entry><entry><title>Animated Sorting Algorithms</title><link href="https://simonwillison.net/2008/Oct/21/animated/#atom-tag" rel="alternate"/><published>2008-10-21T00:17:04+00:00</published><updated>2008-10-21T00:17:04+00:00</updated><id>https://simonwillison.net/2008/Oct/21/animated/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://vision.bc.edu/~dmartin/teaching/sorting/anim-html/all.html"&gt;Animated Sorting Algorithms&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
JavaScript animations of various sorting algorithms, running against four different initial conditions (random, nearly ordered, reversed and few unique). I wish I’d had this during my computer science degree.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="http://www.reddit.com/r/programming/comments/78775/grade_school_teachers_can_do_linear_time_sorting/c05xyak"&gt;programming.reddit.com&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/algorithms"&gt;algorithms&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/computer-science"&gt;computer-science&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/sorting"&gt;sorting&lt;/a&gt;&lt;/p&gt;



</summary><category term="algorithms"/><category term="animation"/><category term="computer-science"/><category term="sorting"/></entry><entry><title>jQuery.ScrollTo</title><link href="https://simonwillison.net/2008/Jan/21/scrollto/#atom-tag" rel="alternate"/><published>2008-01-21T21:53:00+00:00</published><updated>2008-01-21T21:53:00+00:00</updated><id>https://simonwillison.net/2008/Jan/21/scrollto/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.freewebs.com/flesler/jQuery.ScrollTo/"&gt;jQuery.ScrollTo&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Neat jQuery plugin for animated scrolling of both windows and overflow elements.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="http://plugins.jquery.com/project/ScrollTo"&gt;jQuery Plugins&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jquery"&gt;jquery&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/plugins"&gt;plugins&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/scrolling"&gt;scrolling&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/scrollto"&gt;scrollto&lt;/a&gt;&lt;/p&gt;



</summary><category term="animation"/><category term="javascript"/><category term="jquery"/><category term="plugins"/><category term="scrolling"/><category term="scrollto"/></entry><entry><title>Lego Millenium Falcon Stop Motion</title><link href="https://simonwillison.net/2007/Jul/3/youtube/#atom-tag" rel="alternate"/><published>2007-07-03T23:03:42+00:00</published><updated>2007-07-03T23:03:42+00:00</updated><id>https://simonwillison.net/2007/Jul/3/youtube/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.youtube.com/watch?v=aEc8v1OWeE4"&gt;Lego Millenium Falcon Stop Motion&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
This introduced me to a whole world of YouTube Star Wars lego stop motion videos.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/animation"&gt;animation&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/lego"&gt;lego&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/milleniumfalcon"&gt;milleniumfalcon&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/starwars"&gt;starwars&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/stopmotion"&gt;stopmotion&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/youtube"&gt;youtube&lt;/a&gt;&lt;/p&gt;



</summary><category term="animation"/><category term="lego"/><category term="milleniumfalcon"/><category term="starwars"/><category term="stopmotion"/><category term="youtube"/></entry></feed>