Skip to content

Commit

Permalink
Add createVectot and keylsPressed function
Browse files Browse the repository at this point in the history
  • Loading branch information
sekcompsci committed Oct 25, 2017
1 parent 2d215dd commit 302ab9d
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
36 changes: 36 additions & 0 deletions PieSketch/p5js/createVector.rst
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>`_.
33 changes: 33 additions & 0 deletions PieSketch/p5js/keyIsPressed.rst
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>`_.

0 comments on commit 302ab9d

Please sign in to comment.