API: P5 (r3)

API Uses canvas Graphics libraries AB framework Worlds using this API Starter Worlds
P5 (r3) Yes P5 No 569 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:


P5 Particle System
200 runs ♦ 0 likes
By Starter user  
Created: 4 Aug 2018
Modified: 17 Sep 2023
Port of P5 site's "Particle System" example with almost no change. P5 plain API. No AB framework...
P5 chase World
187 runs ♦ 0 likes
By Starter user  
Created: 4 Aug 2018
Modified: 17 Sep 2023
Example of World with Mind on P5 plain API. No AB framework. Have to call Mind yourself. Mind mo...
P5 translate ver...
15 runs ♦ 0 likes
By Starter user  
Created: 21 Sep 2023
Modified: 21 Sep 2023
World to examine P5 "translate"
One Cube World (P5)
1858 runs ♦ 1 like
By Starter user  
Created: 10 Nov 2018
Modified: 17 Sep 2023
Simple starter World (P5 version). No camera control. So cube rotates to show 3D.