JavaScript 🌲 Christmas Calendar 📅 Day 13 🎄

Поделиться
HTML-код
  • Опубликовано: 30 янв 2025

Комментарии • 13

  • @javifontalva7752
    @javifontalva7752 Месяц назад +2

    I am wondering you didn't use a for loop.

    • @Radu
      @Radu  Месяц назад

      Oh, great idea! Then we could have a parameter to control how many blocks the tree has :-)

  • @spacticals
    @spacticals Месяц назад +2

    I think this is the first time I have stopped the video at the beginning after knowing the name of the canvas topic and trying it by myself, and believe me, I was approx 90% done with this, and I am very happy for this. All credit goes to you, sir.

    • @Radu
      @Radu  Месяц назад

      Good for you :-)

  • @___d3p1
    @___d3p1 Месяц назад +1

    Wonderful tree! I'm not having a great end to the year, but your videos always help keep my mind calm and my brain working. Thank you so much!

    • @Radu
      @Radu  Месяц назад +1

      Sorry to hear :-(
      ... I've had like that in the past, and focusing on work (coding / research) was probably the good thing to do (keeps your mind off things)
      Hope things get better in the new year!

  • @egbertludema
    @egbertludema Месяц назад +1

    I created this drawTriangle function:
    function drawTriangle(ctx, block, x) {
    ctx.beginPath();
    ctx.moveTo(block.left, block.bottom);
    ctx.lineTo(block.right, block.bottom);
    ctx.lineTo(x, block.top);
    ctx.fill();
    }

    • @Radu
      @Radu  Месяц назад +1

      Good! It can make the code shorter :-)
      But look at the function and think about someone seeing it for the first time and noticing the name 'drawTriangle' and those parameters, especially 'block' and 'x'. They will wonder "where is the triangle", "what is this block", and then spend a lot of time figuring stuff out. How could the function be made clearer?

  • @shaddow11ro
    @shaddow11ro Месяц назад +1

    Oh noo, i'm late to the party! Plain and simple! But Radu why no function? 😁

    • @Radu
      @Radu  Месяц назад +1

      :-)) I need to give you something to do, don't I? 🌲

    • @shaddow11ro
      @shaddow11ro Месяц назад +1

      @@Radu 😂

  • @TahaJSDev
    @TahaJSDev Месяц назад +1

    Hello my dear teacher, you said that i coded 20 hours non stop how you do that? today i coded 3 hours non stop and I became really tired I was coding a basic snake game :)

    • @Radu
      @Radu  Месяц назад

      I don't recommend coding for too long, uninterrupted... but to answer your question, coding relatively easy things (things that are familiar to you) will become easier and easier the more you code. At some point it becomes 'doing something fun'.