-
Keeps it "simple" for scripters to bring modules in.
- "
require
is just an ordinary function that takes a string and returns useful stuff..."
- "
-
Follows the "de facto" JS module standard.
- Mainstream JS modules already support this pattern as part of the "module systems magic dance."
-
Offers a backwards-compatible, transitional way to migrate existing
Script.include
modules. -
Can start with truly featherweight implementations.
- A minimalist
var api = require(url);
polyfill can be realized in half-a-dozen lines of local JS code.
- A minimalist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gas = require('./gas'); | |
var speed = 0; | |
exports.drive = function () { | |
gas.burn(); | |
}; | |
exports.accelerate = function () { | |
speed += 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- for gist purposes this BASE HREF makes everything load relative to the current live web examples --> | |
<!-- note: save this file in a subfolder off the the project root and remove the BASE HREF to experimental locally --> | |
<base href='https://humbletim.github.io/glm-js/code/test/index.html' /> | |
<!-- glm-js core scripts --> | |
<script src="../src/glm.common.js" type="text/javascript"></script> | |
<script src="../src/glm.buffers.js" type="text/javascript"></script> | |
<script src="../src/glm.experimental.js" type="text/javascript"></script> | |
<!-- specific vendor back-end (variations exist for tdl-fast and gl-matrix as well) --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var TROMBONE_URL = "https://s3.amazonaws.com/hifi-public/tony/audio/sad-trombone.wav"; | |
return { | |
_resource: SoundCache.prefetch(TROMBONE_URL), | |
_sound: undefined, | |
_onStateChanged: function() { | |
var resource = this._resource; | |
if (resource.state === Resource.State.FINISHED) { | |
resource.stateChanged.disconnect(this, '_onStateChanged'); | |
this._sound = SoundCache.getSound(TROMBONE_URL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var teleport; | |
var portalDestination; | |
var animationURL; | |
var position; | |
function playSound(entityID) { | |
print("playing teleport sound"); | |
if (teleport.downloaded) { | |
if(!position) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test Client script to compare Model Overlay vs. Model Entity behavior for attached child Overlays | |
// humbletim @ 2017.06.23 | |
var overlayProps = { | |
url: MyAvatar.skeletonModelURL, | |
position: Vec3.sum(Quat.getForward(MyAvatar.orientation), MyAvatar.position), | |
scale: 1, | |
}; | |
var ids = { | |
overlays: [ |
I hereby claim:
- I am humbletim on github.
- I am htio (https://keybase.io/htio) on keybase.
- I have a public key ASAavTyTo5Al-oomVMaBaSnjLSLM0lIQ22LyD-sHkC_17go
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function createLead($accessToken, array $lead) | |
{ | |
$method = 'post'; | |
$absUrl = 'https://api.getbase.com/v2/leads'; | |
$headers = array( | |
'User-Agent: BaseCRM/PHP Sample', | |
'Authorization: Bearer ' . $accessToken, | |
'Accept: application/json', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// multicontext test script | |
var script = typeof Script === 'object' ? Script : { type: typeof window === 'object' ? 'browser' : 'unknown' }; | |
var api = typeof KasenAPIExample === 'object' ? KasenAPIExample : {}; | |
var details = { | |
type: script.type + '', | |
api: api + '', | |
now: api.now && api.now() + '', | |
}; |
background (Scene)
color
fog (Scene)
type, color, near, far, density
OlderNewer