Create a simple drawing app using javascript and HTML5 canvas

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • In this video, I'll show you how to create a drawing app using javascript and HTML5 canvas. By the end of the video, you'll have a basic understanding of the canvas and how to work with it using javascript. You'll also learn the basics of event handling within the browser.
    Source code: codepen.io/jav...
    Where you can find me?
    🔗 Links:
    * 🍺 Support free education and buy me a beer: ko-fi.com/adam...
    * 💬 Discord: / discord
    * 📧 Newsletter: www.getrevue.c...
    * ✍️ Blog: dev.to/javascr...
    * 🐦 Twitter: / dev_adamnagy
    * 📷 Instagram: / javascriptacademy

ความคิดเห็น • 35

  • @muratusubaliev3533
    @muratusubaliev3533 หลายเดือนก่อน

    Nice informative content! Thank you!. I was searching for the web technology behind web application in which user able to create shapes, duplicating them, copy/pasting, adding text box and move it/ resize it vice versa. Like in web apps: mapbox, figma, online powerpoint, lucid charts etc...
    I do not know where to start.

  • @dejankarakasevic3791
    @dejankarakasevic3791 2 ปีที่แล้ว +6

    This is amazing please keep it up

  • @samdavepollard
    @samdavepollard 2 ปีที่แล้ว +1

    great job, Adam
    many thanks for sharing your knowledge
    subbed

  • @rayyanabdulwajid7681
    @rayyanabdulwajid7681 7 หลายเดือนก่อน +1

    Can you please add a feature to use an eraser and erase the stuff that we want

  • @puno9585
    @puno9585 ปีที่แล้ว +2

    Hi! Is it possible to set the starting stroke color other different than black? Thanks a lot! Very nice video.

    • @jonnymoebjerg
      @jonnymoebjerg 11 หลายเดือนก่อน +2

      Hi! In the .js file, put this in:
      //Set stroke HTML element value
      document.getElementById("stroke").value = "#ffd500";
      //Set actual stroke color
      ctx.strokeStyle = "#ffd500";

    • @puno9585
      @puno9585 11 หลายเดือนก่อน +1

      @@jonnymoebjerg Thanks a lot, mate!

    • @jonnymoebjerg
      @jonnymoebjerg 11 หลายเดือนก่อน +1

      @@puno9585 You are welcome! :) Feel free to ask me more questions.

  • @uginh2rov798
    @uginh2rov798 ปีที่แล้ว

    If you draw on a wacom tablet, then the line makes strange loops (first jumps forward, then takes a few steps back)

  • @zainul_abid
    @zainul_abid ปีที่แล้ว +1

    stratX and startY variable never use?

  • @marcfauve6971
    @marcfauve6971 ปีที่แล้ว

    Merci Beaucoup :)

  • @jnvsexam
    @jnvsexam 2 ปีที่แล้ว

    Sir please start app developer series

  • @hossamhatem6092
    @hossamhatem6092 ปีที่แล้ว

    hey dude , can you tell me the name of the VS CODE theme you use please?

  • @oandrezin3091
    @oandrezin3091 5 หลายเดือนก่อน

    Sounds stupid, but how can i make it so the lines head the opposite way the mouse goes?

  • @phucphanhoang1918
    @phucphanhoang1918 2 ปีที่แล้ว

    I can't use it for mobile devices , you can help me ?

  • @blueberry1874
    @blueberry1874 ปีที่แล้ว

    is it possible to add a stabiliser to the line?

  • @Princeconceptdesigns
    @Princeconceptdesigns 11 หลายเดือนก่อน

    How can I add eraser

  • @Adilxec
    @Adilxec 7 หลายเดือนก่อน

    can we add this app in our website ?

  • @hudamulla9050
    @hudamulla9050 ปีที่แล้ว

    How to add undo tool in this

  • @BenoitAdam2
    @BenoitAdam2 ปีที่แล้ว

    Nice, how to save the image then ?

    • @CanadianCatDaddy
      @CanadianCatDaddy ปีที่แล้ว +2

      get your phone, take a pic, and send to 5 friends for backup

  • @GamerWhoTouchedGrass
    @GamerWhoTouchedGrass 2 ปีที่แล้ว

    How to fill?

  • @rohansharma555
    @rohansharma555 2 ปีที่แล้ว +3

    How do you get the drawing to work on mobile devices?

    • @yashakayash4888
      @yashakayash4888 2 ปีที่แล้ว +1

      Use touchdown, touchmove and other touch events rather than using click, change etc....

    • @graybab
      @graybab ปีที่แล้ว +3

      Replace "mousemove", "mousedown", etc. with "pointermove", "pointerdown", etc. etc.
      And don't forget to add: "touch-action: none;" to your css for the canvas or it'll be glitchy.

    • @vaibhavjain79
      @vaibhavjain79 ปีที่แล้ว

      @@graybab thanks

  • @siyapatil4098
    @siyapatil4098 ปีที่แล้ว

    what does e => mean?

  • @CanadianCatDaddy
    @CanadianCatDaddy ปีที่แล้ว

    mobile friendly?

    • @JsAcademyOfficial
      @JsAcademyOfficial  ปีที่แล้ว

      To make it mobile friendly you should use gesture support I’d probably choose hammerJs

  • @csr4969
    @csr4969 2 ปีที่แล้ว

    sir i want code of this

    • @JsAcademyOfficial
      @JsAcademyOfficial  2 ปีที่แล้ว +1

      The source code is available in the video's description

    • @yavorgerdzhikov-velomotori
      @yavorgerdzhikov-velomotori ปีที่แล้ว

      @@JsAcademyOfficial Hi guys!
      How can I get one piece of code to put on my website and start working? I am confused to be honest:) Any idea?