1.3: Basics of drawing - p5.js Tutorial

The Coding Train
1 Sept 201515:11

Summary

TLDRThis introductory video covers the basics of using p5.js for beginners, focusing on the coordinate system and shapes. The speaker explains how to draw on a canvas through programming by using functions like 'rect()' to create shapes. They break down the importance of syntax, arguments, and how to place shapes on the canvas using x and y coordinates. Additionally, the video touches on key functions such as 'setup()' and 'draw()', which manage how and when code is executed. The speaker encourages experimentation with various shapes and highlights how programming is more than just drawing.

Takeaways

  • 😀 This video is an introductory tutorial aimed at beginners with no prior programming knowledge.
  • 🎨 The video focuses on the basics of p5.js, specifically the coordinate system and how to draw shapes.
  • 🖌 Drawing is introduced as an accessible entry point into programming, especially for those with a visual inclination.
  • 🌐 Programming is described as the process of giving instructions to a computer, often through functions.
  • 📐 The concept of 'arguments' in functions is introduced, which are necessary to define the specifics of a command.
  • 🔢 The importance of syntax in programming is emphasized, as even small errors like missing commas can cause issues.
  • 📊 The Cartesian coordinate system is explained, with a focus on how it applies to computer graphics, particularly in p5.js.
  • 📝 The video demonstrates how to use the 'rect()' function to draw rectangles on a canvas, including specifying positions and dimensions.
  • 🔄 The process of trial and error in programming is encouraged as a way to learn and understand how different functions work.
  • 🔍 The p5.js website is highlighted as a valuable resource for learning more about different functions and their syntax.
  • 🔁 The video concludes with a brief mention of the 'setup()' and 'draw()' functions, which will be explored in more depth in future tutorials.

Q & A

  • What is the main topic of this introductory programming video?

    -The main topic of this introductory programming video is the coordinate system and shapes in the context of p5.js, which is a JavaScript library for creating graphics and interactive experiences.

  • Why does the video emphasize the importance of drawing in learning programming?

    -Drawing is emphasized as a starting point in learning programming because it provides a visual and interactive way to understand basic programming concepts, especially for those who are visual designers or have an interest in visual arts.

  • What is the significance of the 'rect()' function in the context of this video?

    -The 'rect()' function is significant because it is used to demonstrate how to draw a rectangle on the canvas, which is a fundamental operation in graphics programming with p5.js.

  • How does the video explain the concept of arguments in functions?

    -The video explains the concept of arguments by showing how they are used in the 'rect()' function to specify the position and size of a rectangle on the canvas, highlighting that arguments are essential for giving precise instructions to the computer.

  • What is the role of syntax in programming as discussed in the video?

    -Syntax plays a crucial role in programming as it defines the structure of statements in a way that the computer can understand. The video emphasizes that even small mistakes in syntax, like missing commas or parentheses, can lead to errors.

  • How does the video introduce the Cartesian coordinate system in relation to programming?

    -The video introduces the Cartesian coordinate system by comparing it to a graph in a geometry class, explaining that points on the canvas are defined by x and y coordinates, with the origin (0,0) typically at the top left corner of the canvas.

  • What is the purpose of the 'createCanvas' function mentioned in the video?

    -The 'createCanvas' function is used to set up the drawing area, or canvas, where the programming will take place. It is called within the 'setup()' function to define the size of the canvas.

  • Why does the video suggest looking at the p5.js website for more information?

    -The video suggests looking at the p5.js website for more information because it provides a comprehensive reference for all the functions and their expected arguments, which is essential for learning how to use the library effectively.

  • What are the two primary functions where code is placed in a p5.js sketch according to the video?

    -The two primary functions where code is placed in a p5.js sketch are 'setup()' and 'draw()'. The 'setup()' function is used for one-time setup like creating the canvas, and the 'draw()' function is used for the code that runs repeatedly, such as drawing shapes.

  • How does the video encourage learners to explore different shapes in p5.js?

    -The video encourages learners to explore different shapes in p5.js by suggesting they try out various functions like 'ellipse', 'line', 'arc', and others, and by directing them to the p5.js website's reference section to understand the syntax and arguments for each shape.

Outlines

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Mindmap

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Keywords

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Highlights

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード

Transcripts

plate

このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。

今すぐアップグレード
Rate This

5.0 / 5 (0 votes)

関連タグ
p5.jsProgrammingBeginner TutorialDrawingShapesCanvasSyntaxJavaScriptCartesian PlaneCreative Coding
英語で要約が必要ですか?