Home Artists Posts Import Register

Content

We are releasing one Bach Invention portrait every day for 15 days, with Chris (Gruber_music) who remade the musics in Pico-8. (I can't prove it yet, but I'm fairly certain he used some form of black magic)

Hi everyone!

The 14th Bach portrait features a sunset gradient in the background! Let's see how I made that!

First, you'll need an array of the colors you want in your gradient! You should repeat the colors several times in the array in relation to how much they should appear in the gradient. All the while keep in mind that each color will take up 8 pixels in height. Have a big enough array so that it will cover the gradient area you want.

In this portrait, my array of colors looks like this:

<code>
local cols={9,10,15,15,12,12,12,12,1,1}
</code>

Next, you want an array of fill patterns! You need four patterns, every one more dense than the next. You can actually use whatever pattern you want, as long as they get less dense as you go down the array. Here are what the patterns I used look like:

<code>
0 1 1 1 | 0 1 1 0 | 0 1 0 0 | 0 0 0 0
1 0 1 1 | 0 0 1 1 | 0 0 1 0 | 0 0 1 0
1 1 0 1 | 1 0 0 1 | 0 0 0 1 | 0 0 0 1
1 1 1 0 | 1 1 0 0 | 1 0 0 0 | 0 0 0 0
</code>

From there, all you have to do is iterate through your array of colors and for each pair of colors, iterate through the patterns and draw them with a rectfill with 2 pixels of height, always moving up by 2 pixels increments.

<code>local y=64

for i=0,#cols-2 do
color(cols[i+1]*16+cols[i+2])
for j=0,3 do
 fillp(ptrns[j+1])
 rectfill(0,y,127,y-1)
 y-=2
end
end
</code>

And there you have it! A nice, soothing sunset (or any other time of the day, just change the colors) sky gradient!

Thank you for reading! Questions and remarks are both very welcome!

As usual, the downloads for this portrait are available to my 5$+ supporters over there!

Take care and have a nice week-end!

TRASEVOL_DOG

Files

J.S. Bach's Invention No. 14 in Bb Major, BWV 785 (Pico-8 Edition)

Invention No. 14 in Bb Major, BWV 785 composed by J.S. Bach (1685-1750). Music arrangement by Gruber (@gruber_music) Artwork/Animation/Code by Trasevol_Dog (@TRASEVOL_DOG) Support us on Patreon! https://www.patreon.com/Gruber99 https://www.patreon.com/trasevol_dog Arranged and animated in Pico-8. Pico-8 is a fantasy console for making, sharing and playing tiny games and other computer programs. https://www.lexaloffle.com/pico-8.php

Comments

No comments found for this post.