Created
March 14, 2019 17:03
-
-
Save thelucre/50944726197d6130095af1e26553dabd to your computer and use it in GitHub Desktop.
Binding to Scene events in Snapchat Lens Studio
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
// -----JS CODE----- | |
/** | |
* UpdateEvent, fires every frame | |
* @param {UpdateEvent} ev | |
*/ | |
// Callback for the UpdateEvent | |
function onUpdate(ev) { | |
print(getDeltaTime()); | |
} | |
// Binding our callback to the UpdateEvent | |
var updateEvent = script.createEvent("UpdateEvent"); | |
updateEvent.bind(onUpdate); | |
/** | |
* BrowsRaisedEvent, triggered when the user's brows change to raised. | |
* Lens Studio does all of this detection for us, we just listen for the event. | |
* @param {BrowsRaisedEvent} ev | |
*/ | |
// Callback for the BrowsRaisedEvent | |
function onBrowsRaised(ev) { | |
print("My, what high brows you have!"); | |
} | |
// Binding our callback to the BrowsRaisedEvent | |
var browsRaisedEvent = script.createEvent("BrowsRaisedEvent"); | |
browsRaisedEvent.bind(onBrowsRaised); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment