Giter Site home page Giter Site logo

week1.day0.mariopaintmvp's Introduction

week1.day0.marioPaintMVP

Instructions

  1. Use the command line to create a new project folder called marioPaintMVP
  2. Inside of your project folder:
    • Create a JS file, sketch.js
    • Create an HTML file, index.html
    • Make a reference to the JS file
    • Reference the p5.js CDN in your HTML header
    • Start your p5.js using the setup() function to define your canvas (500x500)
    • Create the mouseDragged function (Read the p5.js documentation about how this function works).
    • Inside of the function, create a simple shape that will be drawn at the mouse’s location
    • Use the random() function from p5.js to create the shape with different dimensions each time the shape is created
      • NOTE: this is different from Math.random()
  3. Large Tasks:
    • Draw 3 boxes to the canvas and give them 3 different colors (these will serve as “buttons” for color selection).
    • When the user clicks or presses on these “buttons”, the color values inside of the mouseDragged() function should change to match (See mouseClicked()).
      • HINT: Consider where the mouseX and mouseY is when the it’s clicked and what counts as being inside of the “button”.
    • Finally, create a button for the user to clear the canvas completely and start over.

Extra Credit

  • In addition to changing the dimension of the shape, also change the shape’s fill() color to a random color each time the mouse is dragged
    • NOTE: on the Red-Green-Blue (RBG) scale, each color can have a value from 0-255
  • Instead of creating the same shape every time, create a rectangle or ellipse at random
    • Bonus for creating a triangle, too!
  • On mouse click, have the background change to a random color

Helpful Resources

week1.day0.mariopaintmvp's People

Watchers

James Cloos avatar Victor(ious) Ramirez avatar  avatar Mahdi Shadkam-Farrokhi avatar  avatar  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.