Last active
December 31, 2019 02:54
-
-
Save yearofthewhopper/99bb1620ee5269fb955c8fccdcc83b4b to your computer and use it in GitHub Desktop.
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
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