Skip to content

Instantly share code, notes, and snippets.

@colormono
Last active September 10, 2018 14:25
Show Gist options
  • Select an option

  • Save colormono/7468e1fa890365b4e5be8f2a6f09de2f to your computer and use it in GitHub Desktop.

Select an option

Save colormono/7468e1fa890365b4e5be8f2a6f09de2f to your computer and use it in GitHub Desktop.
[LensStudio: Time difference] Tiempo transcurrido desde la última interacción #LensStudio
// -----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.');
}
}
function start() {
startTime = getTime();
}
// on update
var eventUpdate = script.createEvent('UpdateEvent');
eventUpdate.bind(update);
// on start trigger
var triggerUpdate = script.createEvent('MouthOpenedEvent');
triggerUpdate.bind(start);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment