-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add createVectot and keylsPressed function
- Loading branch information
1 parent
2d215dd
commit 302ab9d
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.. raw:: html | ||
|
||
<script src="https://sketch.netpie.io/widget/p5-widget.js"></script> | ||
|
||
createVector() | ||
============== | ||
|
||
สร้าง p5.Vector ใหม่ (ประเภทข้อมูลสำหรับเก็บเวกเตอร์) นี้จะให้สองหรือสามมิติเวกเตอร์เฉพาะ Euclidean (ที่รู้จักกันเป็นรูปทรงเรขาคณิต) เวกเตอร์ เวกเตอร์เป็นเอนทิตีที่มีทั้งขนาดและทิศทาง | ||
|
||
.. Creates a new p5.Vector (the datatype for storing vectors). This provides a two or three dimensional vector, specifically a Euclidean (also known as geometric) vector. A vector is an entity that has both magnitude and direction. | ||
**รูปแบบการใช้งาน** | ||
|
||
createVector([x],[y],[z]) | ||
|
||
**พารามิเตอร์** | ||
|
||
- ``x`` Number: x องค์ประกอบของเวกเตอร์ | ||
- ``y`` Number: y องค์ประกอบของเวกเตอร์ | ||
- ``z`` Number: z องค์ประกอบของเวกเตอร์ | ||
|
||
.. ``x`` Number: x component of the vector | ||
.. ``y`` Number: y component of the vector | ||
.. ``z`` Number: z component of the vector | ||
**ค่าที่ส่งออกมา** | ||
|
||
p5.Vector | ||
|
||
.. Number: absolute value of given number | ||
.. raw:: html | ||
|
||
<br><br> | ||
|
||
.. [#f1] This document was generated from p5.js whose source code is available on `github <https://github.com/processing/p5.js>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.. raw:: html | ||
|
||
<script src="https://sketch.netpie.io/widget/p5-widget.js"></script> | ||
|
||
keyIsPressed | ||
============ | ||
|
||
คีย์ตัวแปรระบบบูลีนเป็นจริงหากมีการกดปุ่มใด ๆ และเท็จหากไม่มีการกดปุ่มใด ๆ | ||
|
||
.. The boolean system variable keyIsPressed is true if any key is pressed and false if no keys are pressed. | ||
**รูปแบบการใช้งาน** | ||
|
||
keyIsPressed | ||
|
||
.. raw:: html | ||
|
||
<script type="text/p5" data-autoplay data-hide-sourcecode> | ||
var value = 0; | ||
function draw() { | ||
if (keyIsPressed === true) { | ||
fill(0); | ||
} else { | ||
fill(255); | ||
} | ||
rect(25, 25, 50, 50); | ||
} | ||
</script> | ||
|
||
<br><br> | ||
|
||
.. [#f1] This document was generated from p5.js whose source code is available on `github <https://github.com/processing/p5.js>`_. |