(p5, fn)
| 2028 | }; |
| 2029 | |
| 2030 | function camera(p5, fn){ |
| 2031 | //////////////////////////////////////////////////////////////////////////////// |
| 2032 | // p5.Prototype Methods |
| 2033 | //////////////////////////////////////////////////////////////////////////////// |
| 2034 | |
| 2035 | /** |
| 2036 | * Sets the position and orientation of the current camera in a 3D sketch. |
| 2037 | * |
| 2038 | * `camera()` allows objects to be viewed from different angles. It has nine |
| 2039 | * parameters that are all optional. |
| 2040 | * |
| 2041 | * The first three parameters, `x`, `y`, and `z`, are the coordinates of the |
| 2042 | * camera’s position. For example, calling `camera(0, 0, 0)` places the camera |
| 2043 | * at the origin `(0, 0, 0)`. By default, the camera is placed at |
| 2044 | * `(0, 0, 800)`. |
| 2045 | * |
| 2046 | * The next three parameters, `centerX`, `centerY`, and `centerZ` are the |
| 2047 | * coordinates of the point where the camera faces. For example, calling |
| 2048 | * `camera(0, 0, 0, 10, 20, 30)` places the camera at the origin `(0, 0, 0)` |
| 2049 | * and points it at `(10, 20, 30)`. By default, the camera points at the |
| 2050 | * origin `(0, 0, 0)`. |
| 2051 | * |
| 2052 | * The last three parameters, `upX`, `upY`, and `upZ` are the components of |
| 2053 | * the "up" vector. The "up" vector orients the camera’s y-axis. For example, |
| 2054 | * calling `camera(0, 0, 0, 10, 20, 30, 0, -1, 0)` places the camera at the |
| 2055 | * origin `(0, 0, 0)`, points it at `(10, 20, 30)`, and sets the "up" vector |
| 2056 | * to `(0, -1, 0)` which is like holding it upside-down. By default, the "up" |
| 2057 | * vector is `(0, 1, 0)`. |
| 2058 | * |
| 2059 | * Note: `camera()` can only be used in WebGL mode. |
| 2060 | * |
| 2061 | * @method camera |
| 2062 | * @for p5 |
| 2063 | * @param {Number} [x] x-coordinate of the camera. Defaults to 0. |
| 2064 | * @param {Number} [y] y-coordinate of the camera. Defaults to 0. |
| 2065 | * @param {Number} [z] z-coordinate of the camera. Defaults to 800. |
| 2066 | * @param {Number} [centerX] x-coordinate of the point the camera faces. Defaults to 0. |
| 2067 | * @param {Number} [centerY] y-coordinate of the point the camera faces. Defaults to 0. |
| 2068 | * @param {Number} [centerZ] z-coordinate of the point the camera faces. Defaults to 0. |
| 2069 | * @param {Number} [upX] x-component of the camera’s "up" vector. Defaults to 0. |
| 2070 | * @param {Number} [upY] y-component of the camera’s "up" vector. Defaults to 1. |
| 2071 | * @param {Number} [upZ] z-component of the camera’s "up" vector. Defaults to 0. |
| 2072 | * @chainable |
| 2073 | * |
| 2074 | * @example |
| 2075 | * function setup() { |
| 2076 | * createCanvas(100, 100, WEBGL); |
| 2077 | * |
| 2078 | * describe('A white cube on a gray background.'); |
| 2079 | * } |
| 2080 | * |
| 2081 | * function draw() { |
| 2082 | * background(200); |
| 2083 | * |
| 2084 | * // Move the camera to the top-right. |
| 2085 | * camera(200, -400, 800); |
| 2086 | * |
| 2087 | * // Draw the box. |
no test coverage detected