{"id":21930237,"url":"https://github.com/ebabel-games/ebabel","last_synced_at":"2025-03-22T12:45:58.901Z","repository":{"id":57219006,"uuid":"150767649","full_name":"ebabel-games/ebabel","owner":"ebabel-games","description":"Library of reusable game modules to build HTML5 games.","archived":false,"fork":false,"pushed_at":"2018-11-04T22:02:47.000Z","size":308,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T20:21:49.797Z","etag":null,"topics":["games","javascript","library","npm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ebabel-games.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-28T16:32:20.000Z","updated_at":"2021-08-04T13:23:50.000Z","dependencies_parsed_at":"2022-08-28T23:30:43.154Z","dependency_job_id":null,"html_url":"https://github.com/ebabel-games/ebabel","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebabel-games%2Febabel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebabel-games%2Febabel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebabel-games%2Febabel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebabel-games%2Febabel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ebabel-games","download_url":"https://codeload.github.com/ebabel-games/ebabel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244959451,"owners_count":20538626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["games","javascript","library","npm"],"created_at":"2024-11-28T23:08:21.764Z","updated_at":"2025-03-22T12:45:58.876Z","avatar_url":"https://github.com/ebabel-games.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ebabel\n[![Build Status](https://travis-ci.org/ebabel-games/ebabel.svg?branch=master)](https://travis-ci.org/ebabel-games/ebabel)\n\nLibrary of re-useable game modules to build web browser HTML5 games.\n\n## Install\n```\nnpm install --save ebabel\n```\n\n## Generate this README.md document\n```\nnpm run readme\n```\n\n## Contribute to ebabel game modules\nFirst of all, thank you! Please see the [contributing guidelines](CONTRIBUTING.md) so we can start working together effectively.\n\n\n\n\u003ca name=\"audio\"\u003e\u003c/a\u003e\n\n## audio(input) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n`ebabelAudio`\rPlay music or positional sound.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - Multiple objects and properties: camera, url, listener, sound, and audioLoader.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003eObject\u003c/code\u003e | Object with properties to specify theme music parameters. |\n| input.THREE | \u003ccode\u003eObject\u003c/code\u003e | Library THREE.js |\n| input.camera | \u003ccode\u003eObject\u003c/code\u003e | THREE.js camera instance. |\n| input.volume | \u003ccode\u003enumber\u003c/code\u003e | Loudness of the music, ranges from 0 to 1. |\n| input.url | \u003ccode\u003estring\u003c/code\u003e | Path to the theme music file. |\n| input.distance | \u003ccode\u003enumber\u003c/code\u003e | If this is set we are using positional audio. Distance at which the sound is audible. |\n| input.name | \u003ccode\u003estring\u003c/code\u003e | Unique name to identify the theme music and listener in THREE.js camera children. |\n| input.loop | \u003ccode\u003eboolean\u003c/code\u003e | Play theme music in a loop. False by default. |\n| input.autostart | \u003ccode\u003eboolean\u003c/code\u003e | Stars playing the music as soon as it loads. False by default. |\n\n\n\n## Constants\n\n\u003cdl\u003e\n\u003cdt\u003e\u003ca href=\"#mockEG\"\u003emockEG\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003eEG\u003c/code\u003e\nMock EG (eBabel Games) for unit testing purposes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#mockTHREE\"\u003emockTHREE\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003emockTHREE\u003c/code\u003e\nMock THREE.js for unit testing purposes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#mockTHREEx\"\u003emockTHREEx\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003emockTHREEx\u003c/code\u003e\nMock THREEx.js for unit testing purposes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\n## Functions\n\n\u003cdl\u003e\n\u003cdt\u003e\u003ca href=\"#hexStringToInt\"\u003ehexStringToInt(input)\u003c/a\u003e ⇒ \u003ccode\u003enumber\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003ehexStringToInt\u003c/code\u003e\nConvert string hex to integer.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\n\u003ca name=\"mockEG\"\u003e\u003c/a\u003e\n\n## mockEG\n`EG`\rMock EG (eBabel Games) for unit testing purposes.\n\n**Kind**: global constant  \n\u003ca name=\"mockTHREE\"\u003e\u003c/a\u003e\n\n## mockTHREE\n`mockTHREE`\rMock THREE.js for unit testing purposes.\n\n**Kind**: global constant  \n\u003ca name=\"mockTHREEx\"\u003e\u003c/a\u003e\n\n## mockTHREEx\n`mockTHREEx`\rMock THREEx.js for unit testing purposes.\n\n**Kind**: global constant  \n\u003ca name=\"hexStringToInt\"\u003e\u003c/a\u003e\n\n## hexStringToInt(input) ⇒ \u003ccode\u003enumber\u003c/code\u003e\n`hexStringToInt`\rConvert string hex to integer.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003enumber\u003c/code\u003e - Integer conversion.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003estring\u003c/code\u003e | Input hexadecimal color in string format, i.e. #ff0099 |\n\n\n\n\u003ca name=\"light\"\u003e\u003c/a\u003e\n\n## light(input) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n`light`\nSetup a THREE.js PointLight and add it to the scene.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - THREE.PointLight instance.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003eObject\u003c/code\u003e | Parameters and dependencies. |\n| input.THREE | \u003ccode\u003eObject\u003c/code\u003e | Core library of THREE.js |\n| input.scene | \u003ccode\u003eObject\u003c/code\u003e | Scene object where the light will be added. |\n| input.color | \u003ccode\u003ehex\u003c/code\u003e | Dominant color of the light in hexadecima format. Defaults to pure white 0xffffff. |\n| input.position | \u003ccode\u003eArray\u003c/code\u003e | 3D coordinates of where the light should be placed. Defaults to [1, 250, 1]. |\n| input.name | \u003ccode\u003eString\u003c/code\u003e | Name of the light. Defaults to 'main-light'. |\n\n\n\n\u003ca name=\"textSprite\"\u003e\u003c/a\u003e\n\n## textSprite(input) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n`ebabelTextSprite`\rCreate a 2D text sprite that can be added to any THREE.js mesh.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - THREE.js sprite that can be added to a mesh.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003eObject\u003c/code\u003e | Collection of input properties. |\n| input.THREE | \u003ccode\u003eObject\u003c/code\u003e | Library THREE.js object. |\n| input.canvas | \u003ccode\u003eObject\u003c/code\u003e | DOM canvas, i.e. document.createElement('canvas') |\n| input.text | \u003ccode\u003estring\u003c/code\u003e | String of text to display above a sprite. |\n\n\n\n## Functions\n\n\u003cdl\u003e\n\u003cdt\u003e\u003ca href=\"#updatePlayerPositionRotation\"\u003eupdatePlayerPositionRotation(camera, dataStore)\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003eupdatePlayerPositionRotation\u003c/code\u003e\nUpdate the position and rotation of the current player camera.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#keyboardControls\"\u003ekeyboardControls(dataStore)\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003ekeyboardControls\u003c/code\u003e\nUpdate the position and rotation of the current player camera based on keyboard keys pressed up or down.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\n\u003ca name=\"updatePlayerPositionRotation\"\u003e\u003c/a\u003e\n\n## updatePlayerPositionRotation(camera, dataStore)\n`updatePlayerPositionRotation`\rUpdate the position and rotation of the current player camera.\n\n**Kind**: global function  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| camera | \u003ccode\u003eObject\u003c/code\u003e | THREE.js camera. |\n| dataStore | \u003ccode\u003eObject\u003c/code\u003e | Central store of state data. |\n\n\u003ca name=\"keyboardControls\"\u003e\u003c/a\u003e\n\n## keyboardControls(dataStore)\n`keyboardControls`\rUpdate the position and rotation of the current player camera based on keyboard keys pressed up or down.\n\n**Kind**: global function  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| dataStore | \u003ccode\u003eObject\u003c/code\u003e | Central store of state data. |\n\n\n\n## Functions\n\n\u003cdl\u003e\n\u003cdt\u003e\u003ca href=\"#skybox\"\u003eskybox(input)\u003c/a\u003e ⇒ \u003ccode\u003eObject\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003eSkybox\u003c/code\u003e\nSetup a skybox mesh and add it to the scene.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#userData\"\u003euserData(size, position)\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003euserData\u003c/code\u003e\nSetup skybox default userData.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\n\u003ca name=\"skybox\"\u003e\u003c/a\u003e\n\n## skybox(input) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n`Skybox`\nSetup a skybox mesh and add it to the scene.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - Skybox mesh.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003eObject\u003c/code\u003e | Parameters and dependencies. |\n| input.THREE | \u003ccode\u003eObject\u003c/code\u003e | Core library of THREE.js |\n| input.scene | \u003ccode\u003eObject\u003c/code\u003e | Scene object where the skybox will be added. |\n| input.directions | \u003ccode\u003eArray\u003c/code\u003e | Array of image paths for all skybox sides, by directions. |\n| input.size | \u003ccode\u003eNumber\u003c/code\u003e | Size of the skybox. Defaults to 10000. |\n| input.position | \u003ccode\u003eArray\u003c/code\u003e | Position of the skybox as 3D coordinates. Defaults to [0, 0, 0]. |\n\n\u003ca name=\"userData\"\u003e\u003c/a\u003e\n\n## userData(size, position)\n`userData`\nSetup skybox default userData.\n\n**Kind**: global function  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| size | \u003ccode\u003eNumber\u003c/code\u003e | Length of each side of the skybox cube. |\n| position | \u003ccode\u003eArray\u003c/code\u003e | Coordinates where the skybox is to be positioned: Array of 3 numbers. |\n\n\n\n## Functions\n\n\u003cdl\u003e\n\u003cdt\u003e\u003ca href=\"#countArrayElements\"\u003ecountArrayElements(input)\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003ecountArrayElements\u003c/code\u003e\nReturns an object that counts how many times each element is present in a given array.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#deepCopy\"\u003edeepCopy(input)\u003c/a\u003e ⇒ \u003ccode\u003eObject\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003edeepCopy\u003c/code\u003e\nMake a deep copy of an object, i.e. breaks the pointers, so that updating the copy will not change the original.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#dice\"\u003edice()\u003c/a\u003e ⇒ \u003ccode\u003enumber\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003edice\u003c/code\u003e\nThrow 1 die.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#distance\"\u003edistance(i, j)\u003c/a\u003e ⇒ \u003ccode\u003enumber\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003edistance\u003c/code\u003e\nCalculate the distance in 3D space from point \u0026quot;i\u0026quot; x, y, and z coordinates to point \u0026quot;j\u0026quot; x, y, and z coordinates.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#guid\"\u003eguid()\u003c/a\u003e ⇒ \u003ccode\u003estring\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003eguid\u003c/code\u003e\nReturns a globally unique id string following the standard guid format.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#Ido\"\u003eIdo()\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003eIdo\u003c/code\u003e\nReturns a a string that commemorates how many days since Ido died.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#positive\"\u003epositive(input)\u003c/a\u003e ⇒ \u003ccode\u003enumber\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003epositive\u003c/code\u003e\nComputes the positive rounded up value of the input.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#preventXss\"\u003epreventXss(input)\u003c/a\u003e ⇒ \u003ccode\u003estring\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003epreventXss\u003c/code\u003e\nProcesses an input string to prevent Cross Site Scripting injection attacks (XSS). Returns a safe version of that input.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#randomList\"\u003erandomList(input)\u003c/a\u003e ⇒ \u003ccode\u003eobject\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003erandomList\u003c/code\u003e\nReturns the subset of a list of x elements from a larger source list.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#randomPosOrNeg\"\u003erandomPosOrNeg(max)\u003c/a\u003e ⇒ \u003ccode\u003enumber\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003erandomPosOrNeg\u003c/code\u003e\nCalculates a positive or negative random number.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#randomPosition\"\u003erandomPosition(size)\u003c/a\u003e ⇒ \u003ccode\u003earray\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003erandomPosition\u003c/code\u003e\nCalculate new coordinates in a 3D space randomly to generate a new position.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#random\"\u003erandom(max, min)\u003c/a\u003e ⇒ \u003ccode\u003enumber\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003erandom\u003c/code\u003e\nReturns a random integer number from 1 to 100 or from min to max (min is non-inclusive).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#reducedDistance\"\u003ereducedDistance(i, j, r)\u003c/a\u003e ⇒ \u003ccode\u003earray\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003ereducedDistance\u003c/code\u003e\nCalculate new coordinates in a 3D space for point \u0026quot;i\u0026quot; in order\nto get closer to point \u0026quot;j\u0026quot; reducing the distance between the two points by \u0026quot;r\u0026quot; amount.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#trait\"\u003etrait()\u003c/a\u003e ⇒ \u003ccode\u003enumber\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003e\u003ccode\u003etrait\u003c/code\u003e\nThrow 3 dices.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\n\u003ca name=\"countArrayElements\"\u003e\u003c/a\u003e\n\n## countArrayElements(input)\n`countArrayElements`\nReturns an object that counts how many times each element is present in a given array.\n\n**Kind**: global function  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003earray\u003c/code\u003e | Array where element occurences need to be counted. |\n\n\u003ca name=\"deepCopy\"\u003e\u003c/a\u003e\n\n## deepCopy(input) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n`deepCopy`\nMake a deep copy of an object, i.e. breaks the pointers, so that updating the copy will not change the original.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - Copy of the input onject.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003eObject\u003c/code\u003e | Original object that needs to be copied. |\n\n\u003ca name=\"dice\"\u003e\u003c/a\u003e\n\n## dice() ⇒ \u003ccode\u003enumber\u003c/code\u003e\n`dice`\nThrow 1 die.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003enumber\u003c/code\u003e - Return a random integer from 1 to 6.  \n\u003ca name=\"distance\"\u003e\u003c/a\u003e\n\n## distance(i, j) ⇒ \u003ccode\u003enumber\u003c/code\u003e\n`distance`\nCalculate the distance in 3D space from point \"i\" x, y, and z coordinates to point \"j\" x, y, and z coordinates.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003enumber\u003c/code\u003e - Distance between i and j.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| i | \u003ccode\u003earray\u003c/code\u003e | Array start position in 3D space e.g. [-10, 5.1, 3] |\n| j | \u003ccode\u003earray\u003c/code\u003e | Array end position in 3D space e.g. [0, 15.1, -7] |\n\n\u003ca name=\"guid\"\u003e\u003c/a\u003e\n\n## guid() ⇒ \u003ccode\u003estring\u003c/code\u003e\n`guid`\nReturns a globally unique id string following the standard guid format.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003estring\u003c/code\u003e - Guid of 36 characters, including hyphens.  \n\u003ca name=\"Ido\"\u003e\u003c/a\u003e\n\n## Ido()\n`Ido`\nReturns a a string that commemorates how many days since Ido died.\n\n**Kind**: global function  \n\u003ca name=\"positive\"\u003e\u003c/a\u003e\n\n## positive(input) ⇒ \u003ccode\u003enumber\u003c/code\u003e\n`positive`\nComputes the positive rounded up value of the input.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003enumber\u003c/code\u003e - Positive value of the input number.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003enumber\u003c/code\u003e | Number to be converted into positive. |\n\n\u003ca name=\"preventXss\"\u003e\u003c/a\u003e\n\n## preventXss(input) ⇒ \u003ccode\u003estring\u003c/code\u003e\n`preventXss`\nProcesses an input string to prevent Cross Site Scripting injection attacks (XSS). Returns a safe version of that input.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003estring\u003c/code\u003e - Cleaned string that shouldn't run any javascript code if displayed on a webpage.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003estring\u003c/code\u003e | The user input string that needs to be sanitized, to remove the possibility of injecting script of other html tags. |\n\n\u003ca name=\"randomList\"\u003e\u003c/a\u003e\n\n## randomList(input) ⇒ \u003ccode\u003eobject\u003c/code\u003e\n`randomList`\nReturns the subset of a list of x elements from a larger source list.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eobject\u003c/code\u003e - 2 arrays in an object: list and rest.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003eobject\u003c/code\u003e | Input properties: source and max. |\n| input.source | \u003ccode\u003earray\u003c/code\u003e | The source property is the array from which a max number of elements will be randomly selected. |\n| input.max | \u003ccode\u003enumber\u003c/code\u003e | Number of elements that will be randomly selected from input.source |\n\n\u003ca name=\"randomPosOrNeg\"\u003e\u003c/a\u003e\n\n## randomPosOrNeg(max) ⇒ \u003ccode\u003enumber\u003c/code\u003e\n`randomPosOrNeg`\nCalculates a positive or negative random number.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003enumber\u003c/code\u003e - Positive or negative number randomly generated.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| max | \u003ccode\u003enumber\u003c/code\u003e | Maximum value that can be generated. |\n\n\u003ca name=\"randomPosition\"\u003e\u003c/a\u003e\n\n## randomPosition(size) ⇒ \u003ccode\u003earray\u003c/code\u003e\n`randomPosition`\nCalculate new coordinates in a 3D space randomly to generate a new position.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003earray\u003c/code\u003e - Array of generated position coordinates.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| size | \u003ccode\u003earray\u003c/code\u003e | Array of 3 numbers for the width, height and depth, respectively. |\n\n\u003ca name=\"random\"\u003e\u003c/a\u003e\n\n## random(max, min) ⇒ \u003ccode\u003enumber\u003c/code\u003e\n`random`\nReturns a random integer number from 1 to 100 or from min to max (min is non-inclusive).\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003enumber\u003c/code\u003e - Integer between min and max (inclusively)  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| max | \u003ccode\u003enumber\u003c/code\u003e | the maximum to be returned, should be an integer |\n| min | \u003ccode\u003enumber\u003c/code\u003e | the minimum to be returned, should be an integer |\n\n\u003ca name=\"reducedDistance\"\u003e\u003c/a\u003e\n\n## reducedDistance(i, j, r) ⇒ \u003ccode\u003earray\u003c/code\u003e\n`reducedDistance`\nCalculate new coordinates in a 3D space for point \"i\" in order\nto get closer to point \"j\" reducing the distance between the two points by \"r\" amount.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003earray\u003c/code\u003e - Array of coordinates the i position should get to in order to get closer to j.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| i | \u003ccode\u003earray\u003c/code\u003e | Array of 3 numbers for the coordinates x, y, z of the source point. |\n| j | \u003ccode\u003earray\u003c/code\u003e | Array of 3 numbers for the coordicates x, y, z of the target point. |\n| r | \u003ccode\u003enumber\u003c/code\u003e | Number by which the distance between i and j needs to be reduced. |\n\n\u003ca name=\"trait\"\u003e\u003c/a\u003e\n\n## trait() ⇒ \u003ccode\u003enumber\u003c/code\u003e\n`trait`\nThrow 3 dices.\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003enumber\u003c/code\u003e - Return a random integer from 3 to 18.  \n\n\n\u003ca name=\"boundingBox\"\u003e\u003c/a\u003e\n\n## boundingBox(THREE, mesh)\n`boundingBox`\nCalculate a 3D bounding box for a THREE.js mesh.\n\n**Kind**: global function  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| THREE | \u003ccode\u003eobject\u003c/code\u003e | Core library of THREE.js |\n| mesh | \u003ccode\u003estring\u003c/code\u003e | 3D THREE.js object for a mesh that needs a bounding box calculated. |\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febabel-games%2Febabel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febabel-games%2Febabel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febabel-games%2Febabel/lists"}