Each high-level display object package (sprite, mesh, etc) has common code as well as renderer-specific adapters. This can be achieved with exports
in the package.json.
// install
import '@pixi/sprite/gl';
import '@pixi/sprite/gpu';
import { useEffect, useState } from "react"; | |
const getInitialTheme = (): Theme => | |
document.documentElement.className.includes("dark") ? "dark" : "light"; | |
type Theme = "dark" | "light"; | |
function useTheme(): Theme { | |
const [theme, setTheme] = useState<Theme>(getInitialTheme); | |
useEffect(() => { | |
const observer = new MutationObserver(function ([event]) { |
<!DOCTYPE html> | |
<html> | |
<body style="background: #eee;"> | |
<canvas id="myCanvas" width="500" height="500" style="border:1px solid #d3d3d3;background: #fff;image-rendering: pixelated;"> | |
</canvas> | |
<script> | |
var canvas = document.getElementById("myCanvas"); | |
var ctx = canvas.getContext("2d"); |
interface Tickerable { | |
render(time: number): void; | |
} | |
/** | |
* Create a shared, static frame ticker. Using many requestAnimationFrame | |
* callbacks can be a performance killer, so this wraps multiple targets | |
* with a single requestAnimationFrame call. | |
*/ | |
class Ticker { |
// Create a new project object | |
var myProject = app.project; | |
// Get the current composition | |
var myComp = myProject.activeItem; | |
// Create a new render queue item | |
var myRenderItem = myProject.renderQueue.items.add(myComp); | |
// Set the output module to lossless |
/** | |
* sourceRectAtTime isn't useful for shape layers, we need to compute based on the vectors. | |
* @param {ShapeLayer} layer - Shape layer | |
* @param {number} time | |
*/ | |
function getShapeBounds(layer, time) { | |
var layerPosition = layer.position.valueAtTime(time, false); | |
var layerAnchor = layer.anchorPoint.valueAtTime(time, false); | |
var leftLayerOffset = layerPosition[0] - layerAnchor[0]; | |
var topLayerOffset = layerPosition[1] - layerAnchor[1]; |
/** | |
* Layers in AE ExtendScript are notoriously hard to understand | |
* the heirarchy of properties. I use this utility to output the properties/groups | |
* @param {*} obj - can be a Layer or object | |
* @param {number} [indent=0] - starting indent | |
*/ | |
function describeObject(obj, indent) { | |
indent = indent || 0; | |
var indentString = ""; | |
for (var i = 0; i < indent; i++) { |
import * as fs from 'fs'; | |
import * as https from 'https'; | |
/** | |
* Very simple remote download file. | |
* @param url - URL file to download | |
* @param filePath - Output file location | |
*/ | |
function downloadFile(url: string, filePath: string): Promise<void> { | |
return new Promise<void>((resolve, reject) => { |
Regular status means upon entering a point of service (restaurant, coffee shop) your exact order can be anticipated without any verbal or physical prompting.
My friend Dave Schlafman is the professional at regular status. He has more regular status in the metro Boston-area than anyone I know--probably dozens of restaurants and coffee shops. I've known this about him since we were at college together. I believe I have distilled down what exactly are the qualities that make regular status possible using Dave as a test case.
[ "@pixi/constants", | |
"@pixi/math", | |
"@pixi/polyfill", | |
"@pixi/runner", | |
"@pixi/settings", | |
"@pixi/unsafe-eval", | |
"@pixi/ticker", | |
"@pixi/utils", | |
"@pixi/display", | |
"@pixi/core", |