Skip to content

Instantly share code, notes, and snippets.

@lassemt
lassemt / main.js
Created March 15, 2019 08:09
Dynamic module import
//
// Async loading modules
//
const AsyncModules = async () => {
// Load and setup forms
let formEls = [...document.querySelectorAll('.Form--ajax')];
if (formEls.length) {
const Forms = await import(/* webpackChunkName: "forms" */ './components/Forms');
formEls.map(formEl => new Forms(formEl));
@lassemt
lassemt / script.js
Created August 4, 2019 15:13
SparkAR greyscale black and white shader
const D = require('Diagnostics');
const Scene = require('Scene');
const Time = require('Time');
const R = require('Reactive');
const S = require('Shaders');
const Mat = require('Materials');
const Tex = require('Textures');
const Patches = require('Patches');
//
@lassemt
lassemt / script.js
Created August 22, 2019 18:19
Spark AR – Counter based on time.
const D = require('Diagnostics');
const Scene = require('Scene');
const Time = require('Time');
const R = require('Reactive');
const FaceTracking = require('FaceTracking');
//
// Define constants
//
const OPENNESS_THRESHOLD = 0.5;
@lassemt
lassemt / script.js
Created January 15, 2020 19:45
SparkAR requestAnimationFrame alternative.
const t = require('Time');
const D = require('Diagnostics');
const Scene = require('Scene');
const objText = Scene.root.find('2dText0');
let frame = 0;
const round = (val, precision = 1) => {
const multiplier = Math.pow(10, precision || 0);
return Math.round(val * multiplier) / multiplier;
const D = require('Diagnostics');
const Patches = require('Patches');
//
// RECVIEVING SIGNALS FROM PATCHES
//
//
// Old way
//
// Put everything that needs to be loaded
// into 1 promise.
Promise.all([
Scene.root.findFirst('directionalLight01'),
Scene.root.findFirst('number'),
Patches.outputs.getScalar('score'),
]).then( (loadedItems) => {
// When everything is loaded
// this function will trigger
//==============================================================================
// The following example demonstrates how to control audio playback by tapping
// on the screen.
//
// Project setup:
// - Import an audio file (M4A, Mono, 44.1kHz, 16 bit)
// - Create an audio playback controller and set the audio to the imported file
// - Insert a speaker and set the audio to the playback controller
// - Add the Tap Gesture capability to the project under Touch Gestures
//==============================================================================
//
// In this script we show how to fade out particles from
// a emitter.
//
// Original post was created by Josh Beckwith
// URL: https://www.facebook.com/groups/SparkARcommunity/permalink/683989935346385/
//
//
// Include modules
I am attesting that this GitHub handle lassemt is linked to the Tezos account tz1LyJAACoEgDbWppjCUBgrfcfkdmf4obMLW for tzprofiles
sig:edsigthM4hxQfKTir6cWXa6wCCubaaj5VVg3ihtk7oWVARLRcix4AydE6BfCvF9cjPeVT8zM2xcVDAz4prtS15HmRf7dLykykzU