Created
April 13, 2020 05:31
-
-
Save yearofthewhopper/b7e97ed1801653746987ef5173028728 to your computer and use it in GitHub Desktop.
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
import { Particle } from './Particle'; | |
import { Ease } from './PFTween'; | |
const FaceTracking = require("FaceTracking"); | |
const HeadRotationTrigger = require("./sparkar-head-rotation-trigger.js"); | |
const EventHelpers = require("./sparkar-event-helpers.js"); | |
const Scene = require('Scene'); | |
const TouchGestures = require('TouchGestures'); | |
const Diagnostics = require('Diagnostics'); | |
Scene.root.findFirst('emitter0').then(emitter0 => { | |
const particle = new Particle(emitter0) | |
.setFadeout(Ease.easeInExpo) | |
.setScaleout(Ease.easeInExpo) | |
.setFadeout(Ease.easeInElastic) | |
.stop(); | |
TouchGestures.onTap().subscribe(() => | |
particle | |
.setHue(Math.random(), 0.1) | |
.setValue(1.5) | |
.burst() | |
); | |
function playParticles() { | |
particle | |
.setHue(Math.random(), 0.01) | |
.setValue(100) | |
.burst(100,500); | |
} | |
const face = FaceTracking.face(0); | |
const limitedEvent = EventHelpers.makeLimitedEvent({eventFunction: playParticles}); | |
HeadRotationTrigger.attach({ | |
face: face, | |
eventFunction: limitedEvent, | |
}); | |
}).catch(Diagnostics.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
find Pofu Lu's SparkAR library that this is made from is here