Last year, there was a very popular challenge to create an image containing every 24-bit RGB colour.

My challenge is to create a smooth animation (24 frames/s say), where the colour of every pixel of every frame is unique. I will also allow duplication of colours as long as every colour appears the same number of times (greater than 0), since otherwise the animation will have to be short, or the frames small.

I have produced some examples here, based on the winning solution to the 2d version. Unfortunately, it seems you can't embed videos, so links will have to do.

  • 1
    Someone already did an animation in this answer from the linked question. I'm not sure if it meets the criteria, though. – mbomb007 Sep 11 '15 at 16:50
  • 1
    Bit more technical specs would be nice. What does "create" mean? Render a video to disc? Display a realtime animation? – mınxomaτ Sep 12 '15 at 16:14
  • You could use a gif... – wizzwizz4 Dec 21 '15 at 19:21
  • 1
    @wizzwizz4 a GIF cannot hold more than 256 colors; so you can make a 16x16 image with different colors for every pixel - and have no room left for animation. – Titus Sep 22 '16 at 10:38

Mathematica

This is a straightforward implementation with each rgb colour occupying an intersection in a 256 by 256 by 256 unit grid.

The jerkiness seems to be an artefact of the video, not an error in the data, which should be exact.

red values increase downwards, green values increase rightwards, and blue values increase by frame.

Perhaps I'll jumble things up later.

f@b_ := Image@Table[{r, g, b}/255, {r, 0, 255}, {g, 0, 255}]
Export["c.mov", Table[f@b, {b, 0, 255}]]

QuickTime clip

  • This is puzzling. It works for me and the permissions are set for anyone to access it. Are you able to play other videos at vimeo.com ? – DavidC Sep 12 '15 at 19:12
  • It does work now, for some reason. – Fatalize Sep 12 '15 at 19:15
  • glad to hear it. – DavidC Sep 12 '15 at 19:15

PHP (+ HTML) + JavaScript

Part 1
generate 256 images with distinct red values from 0 to 255;
green value=row index, blue value=column index

for($r=$h=256;$r--;){$i=imagecreatetruecolor($g=$h,$h);for(;$g--;)for($b=$h;$b--;)imagesetpixel($i,$g,$b,imagecolorallocate($i,$r,$g,$b));imagepng($i,"$r.png");imagedestroy($i);}

Note: Depending on Your PHP implementation, this may throw an internal server error.
If it does, take the lowest number of the images that already have been created, insert <number>, after $r= and run again.

Part 2
loop through these images from 0 to 255 and back (0 and 255 taking 2 frames each)

<img><script>r=d=0;setInterval(()=>{document.images[0].src=r+".png",(d?!r--:(++r)>=256)?r-=(d=!d)?1:-1:r},40);</script>

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.