Skip to content

Instantly share code, notes, and snippets.

@thelucre
Created March 14, 2019 17:11
Show Gist options
  • Save thelucre/422c8a83660ccb767d9875bdf92c11b2 to your computer and use it in GitHub Desktop.
Save thelucre/422c8a83660ccb767d9875bdf92c11b2 to your computer and use it in GitHub Desktop.
Count the number of eyebrow raises in Snapchat Lens Studio
// -----JS CODE-----
var highBrowCount = 0;
/**
* BrowsRaisedEvent, triggered when the user's brows change to raised.
* LensStudio 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! Brows raised " + (++highBrowCount) + " times."
);
}
// 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