This file contains hidden or 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
// Custom Hint | |
// Events docs: https://lensstudio.snapchat.com/api/Events/ | |
//@input SceneObject customHintSprite | |
function showCustomHint() { | |
if (script.customHintSprite) { | |
script.customHintSprite.enabled = true; | |
} | |
} | |
function hideCustomHint() { |
This file contains hidden or 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
// Cámara delantera | |
var eventFront = script.createEvent("CameraFrontEvent"); | |
eventFront.bind(function (eventData){ | |
print("front camera active"); | |
}); | |
// Cámara trasera | |
var eventBack = script.createEvent("CameraBackEvent"); | |
eventBack.bind(function (eventData){ | |
print("back camera active"); |
This file contains hidden or 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
// @input string startTrigger = MouthOpenedEvent { "label":"Start trigger", "widget": "combobox", "values": [ { "label": "Brows Lowered", "value": "BrowsLoweredEvent" }, { "label": "Brows Raised", "value": "BrowsRaisedEvent" }, { "label": "Brows Returned To Normal", "value": "BrowsReturnedToNormalEvent" }, { "label": "Face Found", "value": "FaceFoundEvent" }, { "label": "Face Lost", "value": "FaceLostEvent" }, { "label": "Kiss Finished", "value": "KissFinishedEvent" }, { "label": "Kiss Started", "value": "KissStartedEvent" }, { "label": "Mouth Closed", "value": "MouthClosedEvent" }, { "label": "Mouth Opened", "value": "MouthOpenedEvent" }, { "label": "Smile Finished", "value": "SmileFinishedEvent" }, { "label": "Smile Started", "value": "SmileStartedEvent" }, { "label": "Touch Start", "value": "TouchStartEvent" }, { "label": "Touch End", "value": "TouchEndEvent" }, { "label": "Tap", "value": "TapEvent" } ] } | |
// @input string endTrigger = MouthClosedEvent { "label":"End trigger", "widget": "combobox", "values" |
This file contains hidden or 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
/** | |
* Map number between range | |
*/ | |
function mapNum(input, in_min, in_max, out_min, out_max) { | |
return ((input - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min; | |
} | |
// Example | |
//var mapedNumber = mapNum(someNumVar, -15, 15, -1, 1); |
This file contains hidden or 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 DEG_TO_RAD = 0.0174533; | |
script.Mesh1.getTransform().setLocalRotation( quat.quatFromEuler( 90.0 * DEG_TO_RAD, 45.0 * DEG_TO_RAD, 0.0 * DEG_TO_RAD) ); |
This file contains hidden or 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
// Check the distance between two objects | |
//@input SceneObject objectA | |
//@input SceneObject objectB | |
//@input float distCheck | |
var pointA = script.objectA.getTransform().getWorldPosition(); | |
var pointB = script.objectB.getTransform().getWorldPosition(); | |
var distance = pointA.distance(pointB); | |
if(distance > script.distCheck){ | |
print("Lejos: " + distance); |
This file contains hidden or 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
//@input string startTrigger = MouthOpenedEvent { "label":"trigger", "widget": "combobox", "values": [ { "label": "Brows Lowered", "value": "BrowsLoweredEvent" }, { "label": "Brows Raised", "value": "BrowsRaisedEvent" }, { "label": "Brows Returned To Normal", "value": "BrowsReturnedToNormalEvent" }, { "label": "Face Found", "value": "FaceFoundEvent" }, { "label": "Face Lost", "value": "FaceLostEvent" }, { "label": "Kiss Finished", "value": "KissFinishedEvent" }, { "label": "Kiss Started", "value": "KissStartedEvent" }, { "label": "Mouth Closed", "value": "MouthClosedEvent" }, { "label": "Mouth Opened", "value": "MouthOpenedEvent" }, { "label": "Smile Finished", "value": "SmileFinishedEvent" }, { "label": "Smile Started", "value": "SmileStartedEvent" }, { "label": "Touch Start", "value": "TouchStartEvent" }, { "label": "Touch End", "value": "TouchEndEvent" }, { "label": "Tap", "value": "TapEvent" } ] } | |
function start() | |
{ | |
print("Hello world."); | |
} | |
// Start trigger | |
var eventStart = script.createEvent(script.st |
This file contains hidden or 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
// -----JS CODE----- | |
// Variable to store what time particle started | |
var startTime; | |
function update() { | |
if (startTime) { | |
// Calculate how many seconds have elapsed since we've triggered particles | |
var ageTime = getTime() - startTime; | |
print('Age: ' + ageTime + ' seconds.'); | |
} |
This file contains hidden or 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
# Install ipython3 on Mac OS X Maverics | |
# Update brew | |
brew update | |
brew upgrade | |
# Install Python 3 | |
brew install python3 | |
# Install ipython |