GithubHelp home page GithubHelp logo

pixel-art's Introduction

#PixArt!

Objectives

Let's use jQuery and event listeners to create an interactive web interface that will paint pixels!

CSS has been provided. Let's write the HTML together. You will implement the JavaScript and jQuery!

Step 1: Set Color

When you click the #set-color button, it should change the color of the .brush-color palette to the color you specify in the input field.

  • Create an event that listens for a click on a button with the id of set-color.
  • When this event is fired, it should use jQuery to take the value from the color input field and make the brush swatch that color.

Step 2: Set Color by Enter

The same thing should happen when I press the enter key from inside the input field.

  • Create an event that listens for a click on enter.
  • HINT: 13
  • This listener should also take the value from the color input field and make the brush swatch that color.

Step 3: Create the Canvas

Using jQuery, create divs with the class square and append them to the body.

  • Make a pixel div.
  • Add a class of square to this div.
  • Append this div to the body.
  • Add an event to this div so that it changes color on mouseover to the color of the brush swatch.
  • Repeat this 2000 times.

Step 4

  • Modify the CSS of your square class to change the size of the pixel divs.
  • Modify your code so that you are creating 8000 divs instead of 2000.
  • Change the event that changes your box colors from 'click' to 'mouseover'.
  • Paint a picture!

pixel-art's People

Watchers

James Cloos avatar Keryn Robinson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.