Create a webpage pixel art editor using HTML to organise your content and CSS to style what it looks like. For the first time you will also learn how to use JavaScript to make a webpage respond when you interact with it. Choose the colour of each pixel to make a really unique character!
A pixel art editor like this one.
Using CSS to draw a table
Writing functions in JavaScript
Calling a function using 'onclick'
Creating variables in JavaScript
A computer or tablet capable of accessing the internet.
Use this link to go to the Code Club online project: projects.raspberrypi.org/en/projects/pixel-art and follow each step in the project.
Challenge 1: Create a grid of pixels.
Challenge 2: Make all the pixels clickable.
Challenge 3: Add a colour palette.
Here is some lines of code that iPad users can copy and paste:
<div class="row">
<div class="pixel"></div>
<div class="pixel"></div>
<div class="pixel"></div>
</div>
<div class="row">
<div class="pixel" onclick="setPixelColour(this)"></div>
<div class="pixel" onclick="setPixelColour(this)"></div>
<div class="pixel" onclick="setPixelColour(this)"></div>
</div>
<div id="palette">
<div class="pen" style="background-color: white;"></div>
<div class="pen" style="background-color: black;"></div>
</div>
<div id="palette">
<div class="pen" style="background-color: white;" onclick="setPenColour('white')"></div>
<div class="pen" style="background-color: black;" onclick="setPenColour('black')"></div>
</div>
Here is a link to the finished project: trinket.io/html/8d51291261