Skip to content

Instantly share code, notes, and snippets.

@yearofthewhopper
Last active December 31, 2019 02:54
Show Gist options
  • Save yearofthewhopper/99bb1620ee5269fb955c8fccdcc83b4b to your computer and use it in GitHub Desktop.
Save yearofthewhopper/99bb1620ee5269fb955c8fccdcc83b4b to your computer and use it in GitHub Desktop.
const Scene = require('Scene');
const Animation = require('Animation');
const R = require('Reactive');
const TouchGestures = require('TouchGestures')
const Time = require('Time');
const Materials = require('Materials');
const Patches = require('Patches');
var materialOpacity = 0.3;
var material1 = Materials.get('material1');
var material2 = Materials.get('material2');
const face = Scene.root.find('faceMesh0');
TouchGestures.onTap(face).subscribe(function (gesture) {
if(face.materialIdentifier === material1.identifier) {
face.material = material1;
} else {
face.material = material2;
}
});
var timeout = Time.setTimeout(function () {
var driver = Animation.timeDriver({durationMilliseconds: 400 });
var sampler = Animation.samplers.linear(materialOpacity, 0);
material1.opacity = Animation.animate(driver, sampler);
driver.start();
}, 2500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment