ffmeg as worker can be found at https://github.com/Kagami/ffmpeg.js/
Final build can be obtained via wget https://unpkg.com/[email protected]/ffmpeg-worker-mp4.js
// MIT License | |
// Copyright (c) 2024 Nathan V. Morrical | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
// | |
// Lookup Tables for Transvoxel's Modified Marching Cubes | |
// | |
// Unlike the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm), these tables guarantee | |
// a closed mesh "whose connected components are continuous and free of holes." | |
// | |
// Rotations are prioritised over inversions so that 3 of the 6 cases containing ambiguous faces are never added. 3 extra | |
// cases are added as a post-process, overriding inverses through custom-build rotations to eliminate the rest. | |
// | |
// Uses the exact same co-ordinate system as https://gist.github.com/dwilliamson/c041e3454a713e58baf6e4f8e5fffecd |
// | |
// Lookup Tables for Marching Cubes | |
// | |
// These tables differ from the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm) | |
// | |
// The co-ordinate system has the more convenient properties: | |
// | |
// i = cube index [0, 7] | |
// x = (i & 1) >> 0 | |
// y = (i & 2) >> 1 |
figma.showUI(__html__,{width: 250, height: 250}); | |
// restore previous size | |
figma.clientStorage.getAsync('size').then(size => { | |
if(size) figma.ui.resize(size.w,size.h); | |
}).catch(err=>{}); | |
figma.ui.onmessage = msg => { | |
switch (msg.type) { | |
case "resize": | |
figma.ui.resize(msg.size.w,msg.size.h); | |
figma.clientStorage.setAsync('size', msg.size).catch(err=>{});// save size |
<div id="myApp"> | |
... | |
</div> | |
<script id="quant-worker" type="javascript/worker"> | |
<%= compilation.assets['worker.js'].source() %> | |
</script> |
ffmeg as worker can be found at https://github.com/Kagami/ffmpeg.js/
Final build can be obtained via wget https://unpkg.com/[email protected]/ffmpeg-worker-mp4.js
This is a walkthrough of how to set up Visual Regression Testing with Jest for an application created with create-react-app
.
The following walkthrough uses React as an example, but the approach should work for any modern frontend library! I assume it can be used with Angular, Vue, Cycle.js and more.
This gist walks you through a create-react-app
application as an example of how to set up Visual Regression Testing in Jest using libraries I wrote recently which enable this: jsdom-screenshot
, jest-transform-css
and jest-transform-file
.
var UnityLoader = UnityLoader || { | |
Compression: { | |
identity: { | |
require: function() { | |
return {}; | |
}, | |
decompress: function(data) { | |
return data; | |
}, | |
hasUnityMarker: function() { |
Minimal example making webpack and wasm/Emscripten work together.
Build instructions:
npm install
npm start
http://localhost:8080
// Taken From: | |
// https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment | |
function sqr (x) { | |
return x * x; | |
} | |
function dist2 (v, w) { | |
return sqr(v[0] - w[0]) + sqr(v[1] - w[1]); | |
} |