API: P5 (r1)

API Uses canvas Graphics libraries AB framework Worlds using this API Starter Worlds
P5 (r1) Yes P5 No 3563 Worlds Starter Worlds


This API is for P5 Worlds. It has no Ancient Brain framework. Anything written in P5 should run using this API without change.

This API has the following features:



Templates


ABWorld

This API does not have AB support.
It defines a global variable called "ABWorld" with not much in it:
 

 ABWorld;                 // instance of class ABWorldClass  
 

 ABWorld.canvas;          // a variable to point to the canvas   		
  
 
 ABWorld.fullwidth();     // return full width of window on desktop / screen on mobile 
 ABWorld.fullheight();    // return full height of window on desktop / screen on mobile

Creating canvas

For making screenshots, Ancient Brain needs to find the canvas.
Normally with P5 you createCanvas() and carry on:
 
	  createCanvas ( ... );		 
If the canvas does not display, or if the AB system fails to find the canvas for screenshots, help it out by telling it where the canvas is:
 

	var canvas = createCanvas ( ... );		 

	ABWorld.setCanvas ( canvas );            


Examples

Examples of Worlds that use this API:


Tutorial 7.8 variant
369 runs ♦ 0 likes
By "Coding Train" p...  
Created: 6 Sep 2018
Modified: 17 Sep 2023
Tutorial 7.8 with music and other uploaded images, including from other users. Click on the images.
Tutorial 18.4
106 runs ♦ 0 likes
By "Coding Train" p...  
Created: 9 Sep 2018
Modified: 17 Sep 2023
Texture
Tutorial 2.1
546 runs ♦ 1 like
By "Coding Train" p...  
Created: 4 Sep 2018
Modified: 17 Sep 2023
Variables in p5.js (mouseX, mouseY)
Tutorial 18.7
410 runs ♦ 0 likes
By "Coding Train" p...  
Created: 9 Sep 2018
Modified: 17 Sep 2023
Tutorial 18.7 with full canvas, resized model, sound. Texture on box is image from another user.
Tutorial 7.8
107 runs ♦ 1 like
By "Coding Train" p...  
Created: 5 Sep 2018
Modified: 17 Sep 2023
Objects and Images. On Ancient Brain you can upload your own images. Try it!