Code Monkey home page Code Monkey logo

paintapplication's Introduction

Web Page for Paint Application

AIM:

To design a static website for Paint Application using HTML5 canvas.

DESIGN STEPS:

Step 1:

Requirement collection.

Step 2:

Creating the layout using HTML,CSS and canvas.

Step 3:

Write javascript to capture move events.

Step 4:

Perform the drawing operation based on the user input.

Step 5:

Validate the layout in various browsers.

Step 6:

Validate the HTML code.

Step 6:

Publish the website in the given URL.

PROGRAM :

<title>Canvas Application</title> <style> .maincontainer{ text-align: center; } body{ background-color: palegoldenrod; } canvas{ background-color: white; } </style> <script type="text/javascript"> var shape; var color; function myClickEvent(e){ var ctx = c.getContext("2d"); ctx.beginPath(); if(color==1){ ctx.strokeStyle='red'; }else if(color==2){ ctx.strokeStyle='yellow'; }else if(color==3){ ctx.strokeStyle='blue'; } if(shape == 0){ ctx.arc(e.offsetX,e.offsetY, 45, 0, 2 * Math.PI); ctx.stroke(); }else if(shape == 1){ ctx.moveTo(75, 50); ctx.lineTo(100, 75); ctx.lineTo(100, 25); ctx.closePath(); ctx.stroke(); }else if(shape==2){ ctx.rect(e.offsetX,e.offsetY, 150, 100); ctx.stroke(); }else if(shape==3){ ctx.rect(e.offsetX, e.offsetY, 50, 50); ctx.stroke(); } } function circleClicked(){ shape=0; } function triangleClicked(){ shape=1; } function rectangleClicked(){ shape=2; } function squareClicked(){ shape=3; } function redClicked(){ color=1; } function blueClicked(){ color=3; } function yellowClicked(){ color=2; } </script>

Canvas Drawing Application

</div>
<div>
    <input type="button" id="red" value="Red">
    <input type="button" id="blue" value="Blue">
    <input type="button" id="yellow" value="Yellow">
</div>
    <script type ="text/javascript">
        var c = document.getElementById("myCanvas");
        c.addEventListener("click", myClickEvent);
        document.getElementById("circle").addEventListener("click", circleClicked);
        document.getElementById("line").addEventListener("click",  triangleClicked);
        document.getElementById("rectangle").addEventListener("click",rectangleClicked);
        document.getElementById("square").addEventListener("click",squareClicked);
        document.getElementById("red").addEventListener("click",redClicked);
        document.getElementById("blue").addEventListener("click",blueClicked);
        document.getElementById("yellow").addEventListener("click",yellowClicked);
       
    </script>
    <div class="footer">
      Developed by Deepika Ravikumar.
    </div>

OUTPUT:

output

Result:

Thus a website is designed and validated for paint application using HTML5 canvas.

paintapplication's People

Contributors

gunasekhar159 avatar joeljebitto avatar obedotto 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.