Skip to content

Instantly share code, notes, and snippets.

View tomaspietravallo's full-sized avatar

Tomás Pietravallo tomaspietravallo

View GitHub Profile
@tomaspietravallo
tomaspietravallo / comment.txt
Last active December 31, 2023 22:57
This script will automatically alias "spark" to the Meta Spark Studio CLI corresponding to the latest build found under MacOS's Applications folder
Works as long as the apps are saved with names that follow the pattern
- Meta Spark Studio vXXX.XX
- Meta Spark Studio XXX.XX
Example: Meta Spark Studio v170

Keybase proof

I hereby claim:

  • I am tomaspietravallo on github.
  • I am tomaspietravallo (https://keybase.io/tomaspietravallo) on keybase.
  • I have a public key whose fingerprint is E257 F3B4 FCB2 03EB A048 BF81 AA0E 9A42 DF7F 5E40

To claim this, I am signing this object:

// [email protected]
import { Pool, } from './volts';
// Pool aka 'a pool of dynamically instanced objects'
// A Pool of 'block0' objects, to be spawned under the Focal Distance
const pool = new Pool('block0', 'Focal Distance', {});
// spawn 400 objects, 5 at a time
// (more at a time -> slower)
pool.populate(400, 5);
@tomaspietravallo
tomaspietravallo / how-to-publish-to-npm.md
Created August 16, 2021 02:15 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "https:/yourblog.com"

npm adduser
@tomaspietravallo
tomaspietravallo / ReactiveToVanilla.ts
Created July 5, 2021 21:35
Type for objects composed of Scalar/String/Boolean signals, that get snapshot'ed to their vanilla counterparts
type ReactiveToVanilla<Obj> = {
[Property in keyof Obj]:
Obj[Property] extends ScalarSignal ? number :
Obj[Property] extends StringSignal ? string :
Obj[Property] extends BoolSignal ? boolean
: any
};
import Scene from 'Scene';
import FaceTracking from 'FaceTracking';
import Animation from 'Animation';
/*
Model structure:
- Model
- skeleton (null)
- Armatures (null objs)
- Petal & pollen (meshes)
@tomaspietravallo
tomaspietravallo / skinSmoothing.ts
Last active March 11, 2021 14:21
Made w/ <3 for the Spark AR Community. © Tomás Pietravallo 2021.
/**
* Skin Smoothing Script by Tomás Pietravallo
* Made w/ <3 for the Spark AR Community.
* Commercial use as part of a project is allowed;
* Selling this script on it's own is NOT allowed.
* © Tomás Pietravallo 2021.
* Do NOT remove this attribution.
*/
import M from 'Materials';
import UI from 'NativeUI';
// Made by Tomás Pietravallo for Diego Aguirre & The Spark AR Community
// Import modules
import Patches from 'Patches';
// Import Typescript types
import { BoolSignal } from 'ReactiveModule';
(async function () {
// await is used to get & resolve the getBoolean() promise
const input1: BoolSignal = await Patches.outputs.getBoolean('InputBool1');
#! /bin/bash
# export all arproj found in sub directories. e.g. you want to export several projects in one folder
for i in */*.arproj
do
echo "============================"
/Applications/Spark\ AR\ Studio/Spark\ AR\ Studio.app/Contents/MacOS/sparkTerminalAppleMac export "$i" -d ./
echo "============================"
done
// Set up a From Script variable called 'r' and drag the script to the Patch Editor
const DM = require('DeviceMotion');
const Patches = require('Patches');
const R = require('Reactive');
// send negated rotation to the patch editor
Patches.inputs.setVector(
'r',
R.vector(
DM.worldTransform.rotation.eulerAngles.x,
DM.worldTransform.rotation.eulerAngles.y,