Skip to content

docs(src/events): Use describe() over @alt #5593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/data/local_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import p5 from '../core/main';
* if (myText === null) {
* myText = '';
* }
* describe(`When you type the key name is displayed as black text on white background.
* If you reload the page, the last letter typed is still displaying.`);
* }
*
* function draw() {
Expand All @@ -52,10 +54,6 @@ import p5 from '../core/main';
* storeItem('myText', myText);
* }
* </code></div>
*
* @alt
* When you type the key name is displayed as black text on white background.
* If you reload the page, the last letter typed is still displaying.
*/
p5.prototype.storeItem = function(key, value) {
if (typeof key !== 'string') {
Expand Down Expand Up @@ -127,18 +125,16 @@ p5.prototype.storeItem = function(key, value) {
* if (myColor !== null) {
* background(myColor);
* }
* describe(`If you click, the canvas changes to a random color.·
* If you reload the page, the canvas is still the color it was when the
* page was previously loaded.`);
* }
*
* function mousePressed() {
* myColor = color(random(255), random(255), random(255));
* storeItem('myColor', myColor);
* }
* </code></div>
*
* @alt
* If you click, the canvas changes to a random color.
* If you reload the page, the canvas is still the color it
* was when the page was previously loaded.
*/
p5.prototype.getItem = function(key) {
let value = localStorage.getItem(key);
Expand Down
72 changes: 28 additions & 44 deletions src/events/acceleration.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ p5.prototype.deviceOrientation =
* background(220, 50);
* fill('magenta');
* ellipse(width / 2, height / 2, accelerationX);
* describe('Magnitude of device acceleration is displayed as ellipse size.');
* }
* </code>
* </div>
* @alt
* Magnitude of device acceleration is displayed as ellipse size
*/
p5.prototype.accelerationX = 0;

Expand All @@ -58,11 +57,10 @@ p5.prototype.accelerationX = 0;
* background(220, 50);
* fill('magenta');
* ellipse(width / 2, height / 2, accelerationY);
* describe('Magnitude of device acceleration is displayed as ellipse size');
* }
* </code>
* </div>
* @alt
* Magnitude of device acceleration is displayed as ellipse size
*/
p5.prototype.accelerationY = 0;

Expand All @@ -82,12 +80,10 @@ p5.prototype.accelerationY = 0;
* background(220, 50);
* fill('magenta');
* ellipse(width / 2, height / 2, accelerationZ);
* describe('Magnitude of device acceleration is displayed as ellipse size');
* }
* </code>
* </div>
*
* @alt
* Magnitude of device acceleration is displayed as ellipse size
*/
p5.prototype.accelerationZ = 0;

Expand Down Expand Up @@ -157,11 +153,11 @@ p5.prototype._updatePAccelerations = function() {
* rotateX(radians(rotationX));
* //rotateY(radians(rotationY));
* box(200, 200, 200);
* describe(`red horizontal line right, green vertical line bottom.
* black background.`);
* }
* </code>
* </div>
* @alt
* red horizontal line right, green vertical line bottom. black background.
*/
p5.prototype.rotationX = 0;

Expand Down Expand Up @@ -190,11 +186,11 @@ p5.prototype.rotationX = 0;
* //rotateX(radians(rotationX));
* rotateY(radians(rotationY));
* box(200, 200, 200);
* describe(`red horizontal line right, green vertical line bottom.
* black background.`);
* }
* </code>
* </div>
* @alt
* red horizontal line right, green vertical line bottom. black background.
*/
p5.prototype.rotationY = 0;

Expand Down Expand Up @@ -224,15 +220,14 @@ p5.prototype.rotationY = 0;
* //rotateX(radians(rotationX));
* //rotateY(radians(rotationY));
* box(200, 200, 200);
* describe(`red horizontal line right, green vertical line bottom.
* black background.`);
* }
* </code>
* </div>
*
* @property {Number} rotationZ
* @readOnly
*
* @alt
* red horizontal line right, green vertical line bottom. black background.
*/
p5.prototype.rotationZ = 0;

Expand Down Expand Up @@ -271,12 +266,10 @@ p5.prototype.rotationZ = 0;
* }
*
* print(rotateDirection);
* describe('no image to display.');
* </code>
* </div>
*
* @alt
* no image to display.
*
* @property {Number} pRotationX
* @readOnly
*/
Expand Down Expand Up @@ -316,12 +309,10 @@ p5.prototype.pRotationX = 0;
* rotateDirection = 'counter-clockwise';
* }
* print(rotateDirection);
* describe('no image to display.');
* </code>
* </div>
*
* @alt
* no image to display.
*
* @property {Number} pRotationY
* @readOnly
*/
Expand Down Expand Up @@ -357,12 +348,10 @@ p5.prototype.pRotationY = 0;
* rotateDirection = 'counter-clockwise';
* }
* print(rotateDirection);
* describe('no image to display.');
* </code>
* </div>
*
* @alt
* no image to display.
*
* @property {Number} pRotationZ
* @readOnly
*/
Expand Down Expand Up @@ -403,6 +392,10 @@ p5.prototype._updatePRotations = function() {
* function draw() {
* fill(value);
* rect(25, 25, 50, 50);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when device turns`);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when x-axis turns`);
* }
* function deviceTurned() {
* if (turnAxis === 'X') {
Expand All @@ -415,10 +408,6 @@ p5.prototype._updatePRotations = function() {
* }
* </code>
* </div>
*
* @alt
* 50×50 black rect in center of canvas. turns white on mobile when device turns
* 50×50 black rect in center of canvas. turns white on mobile when x-axis turns
*/
p5.prototype.turnAxis = undefined;

Expand Down Expand Up @@ -446,6 +435,8 @@ let shake_threshold = 30;
* function draw() {
* fill(value);
* rect(25, 25, 50, 50);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when device moves`);
* }
* function deviceMoved() {
* value = value + 5;
Expand All @@ -458,9 +449,6 @@ let shake_threshold = 30;
* }
* </code>
* </div>
*
* @alt
* 50×50 black rect in center of canvas. turns white on mobile when device moves
*/

p5.prototype.setMoveThreshold = function(val) {
Expand Down Expand Up @@ -489,6 +477,8 @@ p5.prototype.setMoveThreshold = function(val) {
* function draw() {
* fill(value);
* rect(25, 25, 50, 50);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when device is being shaked`);
* }
* function deviceMoved() {
* value = value + 5;
Expand All @@ -501,10 +491,6 @@ p5.prototype.setMoveThreshold = function(val) {
* }
* </code>
* </div>
*
* @alt
* 50×50 black rect in center of canvas. turns white on mobile when device
* is being shaked
*/

p5.prototype.setShakeThreshold = function(val) {
Expand All @@ -529,6 +515,8 @@ p5.prototype.setShakeThreshold = function(val) {
* function draw() {
* fill(value);
* rect(25, 25, 50, 50);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when device moves`);
* }
* function deviceMoved() {
* value = value + 5;
Expand All @@ -538,9 +526,6 @@ p5.prototype.setShakeThreshold = function(val) {
* }
* </code>
* </div>
*
* @alt
* 50×50 black rect in center of canvas. turns white on mobile when device moves
*/

/**
Expand All @@ -563,6 +548,8 @@ p5.prototype.setShakeThreshold = function(val) {
* function draw() {
* fill(value);
* rect(25, 25, 50, 50);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when device turns`);
* }
* function deviceTurned() {
* if (value === 0) {
Expand All @@ -583,6 +570,8 @@ p5.prototype.setShakeThreshold = function(val) {
* function draw() {
* fill(value);
* rect(25, 25, 50, 50);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when x-axis turns`);
* }
* function deviceTurned() {
* if (turnAxis === 'X') {
Expand All @@ -595,10 +584,6 @@ p5.prototype.setShakeThreshold = function(val) {
* }
* </code>
* </div>
*
* @alt
* 50×50 black rect in center of canvas. turns white on mobile when device turns
* 50×50 black rect in center of canvas. turns white on mobile when x-axis turns
*/

/**
Expand All @@ -618,6 +603,8 @@ p5.prototype.setShakeThreshold = function(val) {
* function draw() {
* fill(value);
* rect(25, 25, 50, 50);
* describe(`50-by-50 black rect in center of canvas.
* turns white on mobile when device shakes`);
* }
* function deviceShaken() {
* value = value + 5;
Expand All @@ -627,9 +614,6 @@ p5.prototype.setShakeThreshold = function(val) {
* }
* </code>
* </div>
*
* @alt
* 50×50 black rect in center of canvas. turns white on mobile when device shakes
*/

p5.prototype._ondeviceorientation = function(e) {
Expand Down
Loading