Created
January 1, 2011 07:20
-
-
Save cbfrance/761613 to your computer and use it in GitHub Desktop.
viewport rainbows with @media conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# #!/usr/bin/ruby | |
rgb_value = 255 | |
pixel_coordinate = rgb_value * 10 | |
while pixel_coordinate > 0 do | |
print "@media only screen and (max-width: #{pixel_coordinate}px) { \n body { \n background-color: rgb(#{rgb_value},#{rgb_value},#{rgb_value}); } \n }\n" | |
(pixel_coordinate / 255) % 2 == 0 ? rgb_value += 1 : rgb_value -= 1 | |
pixel_coordinate -= 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is just a proof of concept to see of multiple (hundreds) of @media queries was efficient enough to generate seamless hue transformations. It is! It's perfectly fast. Theoretically you could use this for javascript-free parallax effects ala http://github.com/404. Which I'm sure you need all the time.