Skip to content

Instantly share code, notes, and snippets.

@yearofthewhopper
Created April 13, 2020 05:31
Show Gist options
  • Save yearofthewhopper/b7e97ed1801653746987ef5173028728 to your computer and use it in GitHub Desktop.
Save yearofthewhopper/b7e97ed1801653746987ef5173028728 to your computer and use it in GitHub Desktop.
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);
@yearofthewhopper
Copy link
Author

yearofthewhopper commented Apr 13, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment