Skip to content

Instantly share code, notes, and snippets.

var Scene = require('Scene');
var R = require('Reactive');
var TouchGestures = require('TouchGestures');
var canvas = Scene.root.find('canvas');
var rect = canvas.child('rect');
var PIXEL_RATIO = 2.0; // assumes iPhone 8
TouchGestures.onPinch().subscribe(function (gesture) {
// How to use this script:
// (1) Create a new AR Studio project
// (2) Add a plane, assign it a material
// (3) Attach an ExternalTexture to the newly created material
// (4) Add an audio source
// (5) Add ExternalVideo capability and whitelist the video domain
// (6) Add a script, paste this code
// (7) Create a new video: var video = new Video('url', texture, audio);
// (8) Call video.play() / video.stop() somewhere in the script
@neeh
neeh / ar-object-manager.js
Last active May 22, 2018 14:13
AR Studio workaround to add or remove object from the Scene through scripting
// How to use this script:
// (1) Create a new AR Studio project
// (2) Add a new PlaneTracker "planeTracker0"
// (3) Add 10 objects as a child of the planeTacker, call them "object0", "object1", etc..
// (4) Assign a different material to each object
// (5) Import this script
// (6) Run
var S = require('Scene');
var D = require('Diagnostics');
@neeh
neeh / script.js
Created May 20, 2018 19:40
AR Studio ExternalTexture bug when extension is missing
// How to test:
// Create a new project in AR Studio
// Create a new plane as a child of Camera
// Assign a new material to it
// Assign an external texture "externalTexture0" to this material
// Import this script
// Whitelist all the texture domains: s3-eu-west-1.amazonaws.com, maps.googleapis.com, orig00.deviantart.net, dx35vtwkllhj9.cloudfront.net
// Check if those textures work for you...
var D = require('Diagnostics');