Skip to content

Instantly share code, notes, and snippets.

@enjalot
Forked from ejfox/package.json
Last active November 16, 2020 03:55
Show Gist options
  • Save enjalot/0ec957db87a466ff782290f33d4ab528 to your computer and use it in GitHub Desktop.
Save enjalot/0ec957db87a466ff782290f33d4ab528 to your computer and use it in GitHub Desktop.
package-lock.json
node_modules
secret
output*
bubbles0*
*.mp4
*.png
*.json
const { load } = require("@alex.garcia/observable-prerender");
const { Cluster } = require("puppeteer-cluster");
const fs = require("fs");
const d3 = require("d3");
const moment = require("moment");
const outputFolder = 'bubbles007'
const maxConcurrency = 5
let start_date = "20200220"
let end_date = "20201111"
const days = d3.timeDay
.range(realDate(start_date), realDate(end_date))
.map(d => d3.timeFormat("%Y%m%d")(d))
// const notebookId = "@codingwithfire/cmu-covidcast-api-bubbles-export"
// const notebookId = "@codingwithfire/us-bubble-choropleth-travel-from-centroid"
// const notebookId = "@codingwithfire/cmu-covidcast-api-bubbles-textures-interactive-timelapse"
const notebookId = "@codingwithfire/cmu-covidcast-api-bubbles-dark-mode"
// const notebookId = "@codingwithfire/cmu-covidcast-api-counties-sorted-by-population"
const cells = [
"map",
"days",
"date",
// "legend2"
]
async function main() {
try {
fs.mkdirSync(outputFolder)
} catch(e) {}
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency,
});
await cluster.task(async (params) => {
page = params.page
let id = params.data.notebook
let i = params.data.index
let date = params.data.date
console.log("working on ", id, i, date, params.data)
let filename = `${outputFolder}/casesper100k-${date}.png`
// check if image already exists, if so skip
if(fs.existsSync(filename)) {
return console.log("already had", filename);
}
const notebook = await load(id, cells, { page });
// await notebook.redefine("ticks", i);
// const days = await notebook.value("days");
console.log("DATE", i, date)
await notebook.redefine("date", date);
const newdate = await notebook.value("date");
console.log("new date", newdate)
// special for textures
// await notebook.waitFor("legend2");
console.log("filename", filename)
await notebook.screenshot("map", filename);
// let filenameSVG = `${outputFolder}/casesper100k-${date}.svg`
// await notebook.svg("map", filenameSVG);
console.log("saved", i)
// await notebook.screenshot("chart", `${notebookId}.png`.replace("/", "_"));
});
for await (let d of days) {
cluster.queue({
notebook: notebookId,
index: days.indexOf(d),
date: d
});
}
await cluster.idle();
console.log(`ffmpeg -framerate 12 -pattern_type glob -i "${outputFolder}/casesper100k-*.png" -c:v libx264 -vf "scale=iw:ih-1" -pix_fmt yuv420p ${outputFolder}.mp4; `)
await cluster.close();
console.log("exit")
process.exit()
}
main();
function realDate(number) {
let s = "" + number;
//let d = new Date(`${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)} 00:01`);
let d = moment(`${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)} 00:00`);
return d;
}
const { load } = require("@alex.garcia/observable-prerender");
const { Cluster } = require("puppeteer-cluster");
const fs = require("fs");
const outputFolder = 'clusteroutput5'
const howManyArts = 100
const maxConcurrency = 20
const notebookId = "@enjalot/deconstructed-force-directed-graph"
const cells = [
"onions",
"ticks",
"linkDistance",
"onionOpacity",
"width", "height"]
async function main() {
try {
fs.mkdirSync(outputFolder)
} catch(e) {}
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency,
});
await cluster.task(async (params) => {
page = params.page
let id = params.data.notebook
let i = params.data.index
let linkDistance = params.data.linkDistance
let manyBodyStrength = params.data.manyBodyStrength
console.log("working on ", id, i, params.data)
const notebook = await load(id, cells, { page });
await notebook.redefine("ticks", i);
// await notebook.redefine("ticks", 99);
await notebook.redefine("linkDistance", linkDistance);
await notebook.redefine("manyBodyStrength", manyBodyStrength);
await notebook.redefine("onionOpacity", 0.03);
// let sim = await notebook.value("deconstructed")
await notebook.screenshot("onions", `${outputFolder}/screenshot-${("000" + i).slice(-3)}.png`);
console.log("saved", i)
// await notebook.screenshot("chart", `${notebookId}.png`.replace("/", "_"));
});
let arts = Array.from({length:howManyArts}).map((d,i) => i)
for await (let i of arts) {
cluster.queue({
notebook: notebookId,
index: i,
linkDistance: 30,
manyBodyStrength: -30,
xStrength: 0.1,
yStrength: 0.1
// manyBodyStrength: -100 + i/howManyArts * 95
// linkDistance: 5 + i/howManyArts * 55
});
}
await cluster.idle();
console.log(`ffmpeg -framerate 24 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}.mp4; `)
await cluster.close();
console.log("exit")
process.exit()
}
main();
const { load } = require("@alex.garcia/observable-prerender");
const { Cluster } = require("puppeteer-cluster");
const fs = require("fs");
const outputFolder = 'clusteroutput8'
const howManyArts = 72*2
const maxConcurrency = 20
const notebookId = "@enjalot/deconstructed-disjoint-force-directed-graph"
const cells = [
"onions",
"ticks",
"linkDistance",
"xStrength",
"yStrength",
"onionOpacity",
"width", "height"]
async function main() {
try {
fs.mkdirSync(outputFolder)
} catch(e) {}
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency,
});
await cluster.task(async (params) => {
page = params.page
let id = params.data.notebook
let i = params.data.index
console.log("working on ", id, i, params.data)
const notebook = await load(id, cells, { page });
// await notebook.redefine("ticks", i);
await notebook.redefine("ticks", 20);
await notebook.redefine("xStrength", params.data.xStrength);
await notebook.redefine("yStrength", params.data.yStrength);
await notebook.redefine("linkDistance", params.data.linkDistance);
await notebook.redefine("manyBodyStrength", params.data.manyBodyStrength);
await notebook.redefine("onionOpacity", 0.03);
// let sim = await notebook.value("deconstructed")
await notebook.screenshot("onions", `${outputFolder}/screenshot-${("000" + i).slice(-3)}.png`);
console.log("saved", i)
// await notebook.screenshot("chart", `${notebookId}.png`.replace("/", "_"));
});
let arts = Array.from({length:howManyArts}).map((d,i) => i)
for await (let i of arts) {
cluster.queue({
notebook: notebookId,
index: i,
linkDistance: 30,
manyBodyStrength: -30,
xStrength: 0.1 + 0.15 * Math.sin(i/howManyArts * Math.PI),
yStrength: 0.3 - 0.17 * Math.sin(i/howManyArts * Math.PI),
// manyBodyStrength: -100 + i/howManyArts * 95
// linkDistance: 5 + i/howManyArts * 55
});
}
await cluster.idle();
console.log(`ffmpeg -framerate 24 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}.mp4; `)
await cluster.close();
console.log("exit")
process.exit()
}
main();
const { load } = require("@alex.garcia/observable-prerender");
const { Cluster } = require("puppeteer-cluster");
const fs = require("fs");
const outputFolder = 'emojis'
const howManyArts = 20
const maxConcurrency = 5
const notebookId = "@codingwithfire/emojis"
const cells = [
"colorTreemap",
"chosen",
"sortedEmojis",
]
async function main() {
try {
fs.mkdirSync(outputFolder)
} catch(e) {}
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency,
});
await cluster.task(async (params) => {
page = params.page
let id = params.data.notebook
let i = params.data.index
console.log("working on ", id, i, params.data)
const notebook = await load(id, cells, { page });
// await notebook.redefine("ticks", i);
const sorted = await notebook.value("sortedEmojis");
console.log("emoji", i, sorted[i])
await notebook.redefine("chosen", sorted[i]);
const chosen = await notebook.value("chosen");
console.log("new chosen", chosen)
let filename = `${outputFolder}/${emoji}-treemap.png`
let filenameSVG = `${outputFolder}/${emoji}-treemap.svg`
console.log("filename", filename)
await notebook.screenshot("colorTreemap", filename);
await notebook.svg("colorTreemap", filenameSVG);
console.log("saved", i)
// await notebook.screenshot("chart", `${notebookId}.png`.replace("/", "_"));
});
let arts = Array.from({length:howManyArts}).map((d,i) => i)
for await (let i of arts) {
cluster.queue({
notebook: notebookId,
index: i,
});
}
await cluster.idle();
console.log(`ffmpeg -framerate 24 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}.mp4; `)
await cluster.close();
console.log("exit")
process.exit()
}
main();
const { load } = require("@alex.garcia/observable-prerender");
const puppeteer = require("puppeteer");
async function main() {
const outputFolder = 'forceOutput'
const browser = await puppeteer.launch({
defaultViewport: {
deviceScaleFactor: 3,
height: 900,
width: 900
},
// args: [`--window-size=${mapWidth},${mapHeight}`],
});
const notebook = await load(
"@enjalot/deconstructed-force-directed-graph",
["onions", "ticks", "linkDistance", "deconstructed", "width", "height"],
{ browser }
);
await notebook.redefine("width", 900)
await notebook.redefine("height", 600)
let i = 0;
let howManyArts = 100
console.log("making", howManyArts, "arts")
let arts = Array.from({length:howManyArts})
for await (let art of arts) {
await notebook.redefine("ticks", i);
let sim = await notebook.value("deconstructed")
console.log(i, sim.length)
await notebook.screenshot("onions", `${outputFolder}/screenshot-${("000" + i).slice(-3)}.png`);
console.log("saved", i)
i++
}
console.log(`ffmpeg -framerate 8 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}/screenshots.mp4; `)
await notebook.browser.close();
}
main();
{"events":[{"type":"insert_node","version":0,"node_id":0,"user_id":"595405df3c534894","time":"2020-08-25T00:05:15.469Z","node_value_start":"md`# Freaky Dot Patterns\n\n<iframe width"},{"type":"create","version":2,"node_id":null,"user_id":"595405df3c534894","time":"2020-08-25T00:05:15.469Z"},{"type":"modify_title","version":3,"node_id":null,"user_id":"595405df3c534894","time":"2020-08-25T00:05:16.291Z","title":"Freaky Dot Patterns"},{"type":"unpin_node","version":4,"node_id":0,"user_id":"595405df3c534894","time":"2020-08-25T00:05:18.659Z"},{"type":"remove_node","version":6,"node_id":5,"user_id":"595405df3c534894","time":"2020-08-25T00:05:49.541Z","publish_time":"2020-08-25T00:05:50.349Z","publish_user_id":"595405df3c534894","publish_type":"publish"},{"type":"modify_node","version":8,"node_id":7,"user_id":"595405df3c534894","time":"2020-08-25T00:09:44.025Z","is_new":true,"node_value_start":"md` Rotate and Translate\n\n<iframe width"},{"type":"unpin_node","version":9,"node_id":7,"user_id":"595405df3c534894","time":"2020-08-25T00:10:37.214Z"},{"type":"modify_node","version":10,"node_id":7,"user_id":"595405df3c534894","time":"2020-08-25T00:10:43.287Z","node_value_start":"md`## Rotate and Translate\n\n<iframe wid"},{"type":"modify_node","version":12,"node_id":11,"user_id":"595405df3c534894","time":"2020-08-25T00:11:43.636Z","is_new":true,"node_value_start":"md`## Scale\n\n<iframe width=\"560\" height"},{"type":"unpin_node","version":13,"node_id":11,"user_id":"595405df3c534894","time":"2020-08-25T00:11:51.663Z"},{"type":"modify_node","version":15,"node_id":14,"user_id":"595405df3c534894","time":"2020-08-25T00:12:55.964Z","is_new":true,"node_value_start":"html`<pre>HI THERE</pre>`"},{"type":"remove_node","version":17,"node_id":14,"user_id":"595405df3c534894","time":"2020-08-25T00:13:22.252Z"},{"type":"pin_node","version":18,"node_id":11,"user_id":"595405df3c534894","time":"2020-08-25T00:13:23.200Z"},{"type":"unpin_node","version":19,"node_id":11,"user_id":"595405df3c534894","time":"2020-08-25T00:13:29.048Z"},{"type":"modify_node","version":21,"node_id":20,"user_id":"595405df3c534894","time":"2020-08-25T00:13:37.290Z","is_new":true,"node_name":"i"},{"type":"modify_node","version":22,"node_id":20,"user_id":"595405df3c534894","time":"2020-08-25T00:14:58.140Z","node_name":"num"},{"type":"modify_node","version":24,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:16:21.373Z","is_new":true,"node_name":"canvas"},{"type":"modify_node","version":25,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:16:23.536Z","node_name":"canvas"},{"type":"modify_node","version":27,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:16:43.343Z","node_name":"canvas"},{"type":"modify_node","version":28,"node_id":26,"user_id":"595405df3c534894","time":"2020-08-25T00:16:47.257Z","is_new":true,"node_name":"height"},{"type":"modify_node","version":29,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:17:10.893Z","node_name":"canvas"},{"type":"modify_node","version":30,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:17:14.522Z","node_name":"canvas"},{"type":"modify_node","version":31,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:17:16.575Z","node_name":"canvas"},{"type":"modify_node","version":32,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:18:13.160Z","node_value_start":"{\n let canvas = html`<canvas></canvas>"},{"type":"modify_node","version":33,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:18:48.976Z","publish_time":"2020-08-25T00:19:07.297Z","publish_user_id":"595405df3c534894","node_name":"chart","publish_type":"publish"},{"type":"modify_node","version":35,"node_id":20,"user_id":"595405df3c534894","time":"2020-08-25T00:19:44.171Z","node_name":"num"},{"type":"modify_node","version":36,"node_id":34,"user_id":"beed161c3770e09c","time":"2020-08-25T00:20:05.178Z","is_new":true,"node_name":"Chance"},{"type":"modify_title","version":38,"node_id":null,"user_id":"beed161c3770e09c","time":"2020-08-25T00:20:24.199Z","title":""},{"type":"remove_node","version":39,"node_id":37,"user_id":"beed161c3770e09c","time":"2020-08-25T00:21:00.055Z"},{"type":"modify_title","version":40,"node_id":null,"user_id":"beed161c3770e09c","time":"2020-08-25T00:21:00.055Z","title":"Freaky Dot Patterns"},{"type":"modify_node","version":42,"node_id":23,"user_id":"beed161c3770e09c","time":"2020-08-25T00:21:07.132Z","node_name":"chart"},{"type":"modify_node","version":43,"node_id":41,"user_id":"beed161c3770e09c","time":"2020-08-25T00:21:19.586Z","is_new":true,"node_name":"seed"},{"type":"modify_node","version":44,"node_id":23,"user_id":"beed161c3770e09c","time":"2020-08-25T00:21:33.862Z","node_name":"chart"},{"type":"modify_node","version":45,"node_id":23,"user_id":"beed161c3770e09c","time":"2020-08-25T00:22:20.175Z","node_name":"chart"},{"type":"modify_node","version":46,"node_id":23,"user_id":"beed161c3770e09c","time":"2020-08-25T00:22:31.560Z","node_name":"chart"},{"type":"modify_node","version":48,"node_id":47,"user_id":"595405df3c534894","time":"2020-08-25T00:22:45.405Z","is_new":true,"node_name":"d3"},{"type":"modify_node","version":50,"node_id":49,"user_id":"595405df3c534894","time":"2020-08-25T00:24:09.245Z","is_new":true,"node_name":"dots"},{"type":"modify_node","version":51,"node_id":49,"user_id":"595405df3c534894","time":"2020-08-25T00:24:16.685Z","node_name":"dots"},{"type":"modify_node","version":52,"node_id":49,"user_id":"595405df3c534894","time":"2020-08-25T00:24:28.083Z","node_name":"dots"},{"type":"modify_node","version":53,"node_id":49,"user_id":"595405df3c534894","time":"2020-08-25T00:24:33.109Z","node_name":"dots"},{"type":"modify_node","version":54,"node_id":49,"user_id":"595405df3c534894","time":"2020-08-25T00:24:37.246Z","node_name":"dots"},{"type":"modify_node","version":55,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:25:14.808Z","node_name":"chart"},{"type":"modify_node","version":56,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:25:53.074Z","node_name":"chart"},{"type":"modify_node","version":57,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:26:04.320Z","node_name":"chart"},{"type":"modify_node","version":58,"node_id":20,"user_id":"595405df3c534894","time":"2020-08-25T00:26:11.494Z","node_name":"num"},{"type":"modify_node","version":59,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:26:29.244Z","node_name":"chart"},{"type":"modify_node","version":60,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:27:43.024Z","node_name":"chart"},{"type":"modify_node","version":61,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:27:49.605Z","node_name":"chart"},{"type":"modify_node","version":62,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:27:54.305Z","node_name":"chart"},{"type":"modify_node","version":63,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:28:02.091Z","node_name":"chart"},{"type":"modify_node","version":64,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:28:05.764Z","node_name":"chart"},{"type":"modify_node","version":65,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:28:17.881Z","node_name":"chart"},{"type":"modify_node","version":66,"node_id":23,"user_id":"beed161c3770e09c","time":"2020-08-25T00:28:20.506Z","node_name":"chart"},{"type":"modify_node","version":67,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:28:29.044Z","node_name":"chart"},{"type":"modify_node","version":68,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:28:33.727Z","node_name":"chart"},{"type":"modify_node","version":69,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:28:57.990Z","node_name":"chart"},{"type":"modify_node","version":70,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:29:02.018Z","node_name":"chart"},{"type":"modify_node","version":71,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:29:05.276Z","node_name":"chart"},{"type":"modify_node","version":72,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:29:13.844Z","node_name":"chart"},{"type":"modify_node","version":73,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:30:37.742Z","node_name":"chart"},{"type":"modify_node","version":74,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:30:41.773Z","node_name":"chart"},{"type":"modify_node","version":75,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:30:51.801Z","node_name":"chart"},{"type":"modify_node","version":76,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:01.065Z","node_name":"chart"},{"type":"modify_node","version":77,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:08.024Z","node_name":"chart"},{"type":"modify_node","version":78,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:10.183Z","node_name":"chart"},{"type":"modify_node","version":79,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:14.637Z","node_name":"chart"},{"type":"modify_node","version":80,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:15.773Z","node_name":"chart"},{"type":"modify_node","version":81,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:35.885Z","node_name":"chart"},{"type":"modify_node","version":82,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:40.542Z","node_name":"chart"},{"type":"modify_node","version":83,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:31:46.896Z","publish_time":"2020-08-25T00:31:50.347Z","publish_user_id":"595405df3c534894","node_name":"chart","publish_type":"publish"},{"type":"modify_node","version":84,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:32:13.715Z","node_name":"chart"},{"type":"unpin_node","version":85,"node_id":47,"user_id":"beed161c3770e09c","time":"2020-08-25T00:32:34.426Z"},{"type":"unpin_node","version":86,"node_id":41,"user_id":"beed161c3770e09c","time":"2020-08-25T00:32:35.550Z"},{"type":"unpin_node","version":87,"node_id":34,"user_id":"beed161c3770e09c","time":"2020-08-25T00:32:36.340Z"},{"type":"modify_node","version":89,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:32:51.199Z","node_name":"chart"},{"type":"modify_node","version":90,"node_id":88,"user_id":"595405df3c534894","time":"2020-08-25T00:32:53.445Z","is_new":true,"node_name":"angle"},{"type":"modify_node","version":91,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:32:57.685Z","node_name":"chart"},{"type":"modify_node","version":92,"node_id":88,"user_id":"595405df3c534894","time":"2020-08-25T00:33:01.428Z","publish_time":"2020-08-25T00:33:04.837Z","publish_user_id":"595405df3c534894","node_name":"angle","publish_type":"publish"},{"type":"modify_node","version":94,"node_id":93,"user_id":"595405df3c534894","time":"2020-08-25T00:34:20.263Z","is_new":true,"node_value_start":"import { Scrubber } from \"@mbostock/scr"},{"type":"modify_node","version":96,"node_id":95,"user_id":"595405df3c534894","time":"2020-08-25T00:34:42.634Z","is_new":true,"node_name":"i"},{"type":"modify_node","version":97,"node_id":95,"user_id":"595405df3c534894","time":"2020-08-25T00:34:50.834Z","node_name":"angle"},{"type":"remove_node","version":99,"node_id":88,"user_id":"595405df3c534894","time":"2020-08-25T00:34:58.499Z"},{"type":"modify_node","version":100,"node_id":95,"user_id":"595405df3c534894","time":"2020-08-25T00:35:51.505Z","node_name":"angle"},{"type":"modify_node","version":101,"node_id":95,"user_id":"595405df3c534894","time":"2020-08-25T00:36:09.053Z","publish_time":"2020-08-25T00:36:20.618Z","publish_user_id":"595405df3c534894","node_name":"angle","publish_type":"publish"},{"type":"modify_node","version":103,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:37:31.793Z","is_new":true,"node_name":"chart"},{"type":"modify_node","version":104,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:37:34.433Z","node_name":"chart2"},{"type":"modify_node","version":105,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:37:48.790Z","node_name":"chart2"},{"type":"modify_node","version":106,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:37:53.922Z","node_name":"chart2"},{"type":"modify_node","version":107,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:38:04.431Z","node_name":"chart2"},{"type":"modify_node","version":108,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:38:11.426Z","node_name":"chart2"},{"type":"modify_node","version":109,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:38:14.736Z","publish_time":"2020-08-25T00:38:17.265Z","publish_user_id":"595405df3c534894","node_name":"chart2","publish_type":"publish"},{"type":"modify_node","version":111,"node_id":110,"user_id":"595405df3c534894","time":"2020-08-25T00:39:03.573Z","is_new":true,"node_name":"angles"},{"type":"modify_node","version":112,"node_id":95,"user_id":"595405df3c534894","time":"2020-08-25T00:39:06.611Z","node_name":"angle"},{"type":"modify_node","version":113,"node_id":110,"user_id":"595405df3c534894","time":"2020-08-25T00:39:07.497Z","node_name":"angles"},{"type":"modify_node","version":114,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:39:15.111Z","publish_time":"2020-08-25T00:39:40.511Z","publish_user_id":"595405df3c534894","node_name":"chart2","publish_type":"publish"},{"type":"modify_node","version":115,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:41:42.199Z","node_name":"chart2"},{"type":"modify_node","version":116,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:41:58.185Z","node_name":"chart2"},{"type":"modify_node","version":117,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:42:04.994Z","node_name":"chart2"},{"type":"modify_node","version":119,"node_id":118,"user_id":"595405df3c534894","time":"2020-08-25T00:42:49.916Z","is_new":true,"node_name":"color"},{"type":"modify_node","version":120,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:42:56.101Z","node_name":"chart2"},{"type":"modify_node","version":122,"node_id":121,"user_id":"595405df3c534894","time":"2020-08-25T00:43:05.538Z","is_new":true,"node_value_start":"color(0)"},{"type":"modify_node","version":123,"node_id":121,"user_id":"595405df3c534894","time":"2020-08-25T00:43:13.435Z","node_value_start":"color()"},{"type":"modify_node","version":124,"node_id":121,"user_id":"595405df3c534894","time":"2020-08-25T00:43:16.148Z","node_value_start":"color(1)"},{"type":"modify_node","version":125,"node_id":121,"user_id":"595405df3c534894","time":"2020-08-25T00:43:21.669Z","node_value_start":"angles"},{"type":"modify_node","version":126,"node_id":118,"user_id":"595405df3c534894","time":"2020-08-25T00:43:33.943Z","node_name":"color"},{"type":"modify_node","version":127,"node_id":121,"user_id":"595405df3c534894","time":"2020-08-25T00:43:38.846Z","node_value_start":"color(0)"},{"type":"modify_node","version":128,"node_id":118,"user_id":"595405df3c534894","time":"2020-08-25T00:45:52.165Z","node_name":"color"},{"type":"modify_node","version":129,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:46:00.283Z","node_name":"chart2"},{"type":"modify_node","version":130,"node_id":118,"user_id":"595405df3c534894","time":"2020-08-25T00:46:06.171Z","node_name":"color"},{"type":"modify_node","version":131,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:46:43.736Z","node_name":"chart2"},{"type":"modify_node","version":132,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:47:02.138Z","publish_time":"2020-08-25T00:47:09.782Z","publish_user_id":"595405df3c534894","node_name":"chart2","publish_type":"publish"},{"type":"unpin_node","version":133,"node_id":23,"user_id":"beed161c3770e09c","time":"2020-08-25T00:47:18.528Z","publish_time":"2020-08-25T00:47:46.917Z","publish_user_id":"595405df3c534894","publish_type":"publish"},{"type":"modify_node","version":134,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:48:19.078Z","node_name":"chart2"},{"type":"modify_node","version":135,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:49:14.046Z","node_name":"chart2"},{"type":"modify_node","version":136,"node_id":110,"user_id":"595405df3c534894","time":"2020-08-25T00:49:15.360Z","publish_time":"2020-08-25T00:49:24.219Z","publish_user_id":"595405df3c534894","node_name":"angles","publish_type":"publish"},{"type":"modify_node","version":137,"node_id":110,"user_id":"595405df3c534894","time":"2020-08-25T00:49:27.557Z","node_name":"angles"},{"type":"modify_node","version":138,"node_id":110,"user_id":"595405df3c534894","time":"2020-08-25T00:49:43.207Z","node_name":"angles"},{"type":"modify_node","version":139,"node_id":118,"user_id":"595405df3c534894","time":"2020-08-25T00:50:06.092Z","node_name":"color"},{"type":"modify_node","version":140,"node_id":118,"user_id":"595405df3c534894","time":"2020-08-25T00:50:11.136Z","node_name":"color"},{"type":"modify_node","version":141,"node_id":102,"user_id":"595405df3c534894","time":"2020-08-25T00:50:26.932Z","node_name":"chart2"},{"type":"pin_node","version":142,"node_id":23,"user_id":"595405df3c534894","time":"2020-08-25T00:50:52.026Z"},{"type":"modify_node","version":144,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T00:51:41.355Z","is_new":true,"node_name":"chart3"},{"type":"modify_node","version":146,"node_id":145,"user_id":"595405df3c534894","time":"2020-08-25T00:52:05.553Z","is_new":true,"node_value_start":"import { slider } from \"@jashkenas/inpu"},{"type":"unpin_node","version":147,"node_id":145,"user_id":"595405df3c534894","time":"2020-08-25T00:52:06.919Z"},{"type":"move_node","version":148,"node_id":145,"user_id":"595405df3c534894","time":"2020-08-25T00:52:11.284Z"},{"type":"unpin_node","version":149,"node_id":93,"user_id":"595405df3c534894","time":"2020-08-25T00:52:12.447Z"},{"type":"modify_node","version":151,"node_id":150,"user_id":"595405df3c534894","time":"2020-08-25T00:52:31.640Z","is_new":true,"node_value_start":"angles.length * dots.length"},{"type":"modify_node","version":153,"node_id":152,"user_id":"595405df3c534894","time":"2020-08-25T00:53:17.318Z","is_new":true,"node_name":"translateX"},{"type":"modify_node","version":154,"node_id":152,"user_id":"595405df3c534894","time":"2020-08-25T00:53:27.684Z","node_name":"translateX"},{"type":"modify_node","version":155,"node_id":152,"user_id":"595405df3c534894","time":"2020-08-25T00:53:30.601Z","node_name":"translateX"},{"type":"modify_node","version":156,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T00:53:48.478Z","node_name":"chart3"},{"type":"modify_node","version":158,"node_id":157,"user_id":"595405df3c534894","time":"2020-08-25T00:53:59.431Z","is_new":true,"node_value_start":"translateX"},{"type":"modify_node","version":159,"node_id":152,"user_id":"595405df3c534894","time":"2020-08-25T00:54:02.686Z","node_name":"translateX"},{"type":"modify_node","version":160,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T00:54:37.273Z","node_name":"chart3"},{"type":"remove_node","version":162,"node_id":157,"user_id":"595405df3c534894","time":"2020-08-25T00:55:02.332Z"},{"type":"modify_node","version":163,"node_id":20,"user_id":"595405df3c534894","time":"2020-08-25T00:55:03.809Z","node_name":"num"},{"type":"unpin_node","version":164,"node_id":152,"user_id":"beed161c3770e09c","time":"2020-08-25T00:55:07.893Z"},{"type":"modify_node","version":165,"node_id":110,"user_id":"595405df3c534894","time":"2020-08-25T00:55:33.040Z","node_name":"angles"},{"type":"modify_node","version":166,"node_id":152,"user_id":"beed161c3770e09c","time":"2020-08-25T00:55:45.941Z","node_name":"translateX"},{"type":"pin_node","version":168,"node_id":152,"user_id":"beed161c3770e09c","time":"2020-08-25T00:56:02.028Z"},{"type":"unpin_node","version":169,"node_id":152,"user_id":"beed161c3770e09c","time":"2020-08-25T00:56:02.538Z"},{"type":"modify_node","version":170,"node_id":167,"user_id":"595405df3c534894","time":"2020-08-25T00:56:11.981Z","is_new":true,"node_name":"translateY"},{"type":"modify_node","version":171,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T00:56:27.823Z","node_name":"chart3"},{"type":"modify_node","version":172,"node_id":152,"user_id":"595405df3c534894","time":"2020-08-25T00:56:50.221Z","node_name":"translateX"},{"type":"unpin_node","version":173,"node_id":167,"user_id":"595405df3c534894","time":"2020-08-25T00:56:58.234Z","publish_time":"2020-08-25T00:57:29.036Z","publish_user_id":"595405df3c534894","publish_type":"publish"},{"type":"remove_node","version":175,"node_id":174,"user_id":"595405df3c534894","time":"2020-08-25T00:59:18.149Z"},{"type":"modify_node","version":177,"node_id":176,"user_id":"595405df3c534894","time":"2020-08-25T00:59:38.433Z","is_new":true,"node_name":"scale"},{"type":"modify_node","version":178,"node_id":176,"user_id":"595405df3c534894","time":"2020-08-25T00:59:42.755Z","node_name":"scale"},{"type":"unpin_node","version":179,"node_id":176,"user_id":"595405df3c534894","time":"2020-08-25T00:59:44.433Z"},{"type":"modify_node","version":180,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T00:59:57.334Z","node_name":"chart3"},{"type":"modify_node","version":181,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T01:00:11.960Z","node_name":"chart3"},{"type":"modify_node","version":182,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T01:00:19.070Z","node_name":"chart3"},{"type":"modify_node","version":183,"node_id":176,"user_id":"595405df3c534894","time":"2020-08-25T01:00:25.551Z","node_name":"scale"},{"type":"modify_node","version":184,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T01:00:32.092Z","node_name":"chart3"},{"type":"modify_node","version":186,"node_id":185,"user_id":"595405df3c534894","time":"2020-08-25T01:00:55.506Z","is_new":true,"node_name":"chart4"},{"type":"modify_node","version":187,"node_id":143,"user_id":"595405df3c534894","time":"2020-08-25T01:00:59.497Z","node_name":"chart3"},{"type":"move_node","version":188,"node_id":176,"user_id":"595405df3c534894","time":"2020-08-25T01:01:05.705Z"},{"type":"modify_node","version":190,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:01:13.367Z","is_new":true,"node_name":"chart5"},{"type":"modify_node","version":191,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:01:22.503Z","node_name":"chart5"},{"type":"modify_node","version":193,"node_id":192,"user_id":"595405df3c534894","time":"2020-08-25T01:02:02.014Z","is_new":true,"node_name":"scaler"},{"type":"modify_node","version":194,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:02:09.092Z","node_name":"chart5"},{"type":"modify_node","version":195,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:02:18.706Z","node_name":"chart5"},{"type":"modify_node","version":197,"node_id":196,"user_id":"595405df3c534894","time":"2020-08-25T01:02:29.156Z","is_new":true,"node_name":"scale2"},{"type":"unpin_node","version":198,"node_id":196,"user_id":"595405df3c534894","time":"2020-08-25T01:02:31.093Z"},{"type":"modify_node","version":199,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:02:43.588Z","publish_time":"2020-08-25T01:02:57.184Z","publish_user_id":"595405df3c534894","node_name":"chart5","publish_type":"publish"},{"type":"modify_node","version":200,"node_id":192,"user_id":"beed161c3770e09c","time":"2020-08-25T01:04:30.873Z","node_name":"scaler"},{"type":"modify_node","version":201,"node_id":192,"user_id":"beed161c3770e09c","time":"2020-08-25T01:04:44.978Z","node_name":"scaler"},{"type":"modify_node","version":202,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:04:46.772Z","node_name":"chart5"},{"type":"modify_node","version":204,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:05:47.325Z","is_new":true,"node_name":"chart6"},{"type":"modify_node","version":205,"node_id":189,"user_id":"beed161c3770e09c","time":"2020-08-25T01:05:58.601Z","node_name":"chart5"},{"type":"modify_node","version":206,"node_id":189,"user_id":"beed161c3770e09c","time":"2020-08-25T01:06:43.987Z","node_name":"chart5"},{"type":"modify_node","version":207,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:07:27.409Z","node_name":"chart6"},{"type":"modify_node","version":208,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:07:34.742Z","node_name":"chart6"},{"type":"modify_node","version":209,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:07:42.844Z","node_name":"chart6"},{"type":"modify_node","version":210,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:07:47.345Z","node_name":"chart6"},{"type":"modify_node","version":211,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:08:42.034Z","node_name":"chart6"},{"type":"modify_node","version":212,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:10:37.754Z","node_name":"chart6"},{"type":"modify_node","version":213,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:10:45.003Z","node_name":"chart6"},{"type":"modify_node","version":214,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:11:00.809Z","node_name":"chart6"},{"type":"modify_node","version":215,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:12:04.287Z","node_name":"chart6"},{"type":"modify_node","version":216,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:12:07.251Z","node_name":"chart6"},{"type":"modify_node","version":217,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:12:13.141Z","node_name":"chart6"},{"type":"modify_node","version":218,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:12:40.482Z","node_name":"chart6"},{"type":"modify_node","version":219,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:13:01.245Z","node_name":"chart6"},{"type":"modify_node","version":220,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:13:02.694Z","node_name":"chart6"},{"type":"modify_node","version":221,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:13:05.000Z","node_name":"chart6"},{"type":"modify_node","version":222,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:13:12.922Z","node_name":"chart6"},{"type":"modify_node","version":223,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:13:16.106Z","node_name":"chart6"},{"type":"modify_node","version":224,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:13:31.064Z","node_name":"chart6"},{"type":"modify_node","version":225,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:13:35.659Z","node_name":"chart6"},{"type":"modify_node","version":227,"node_id":226,"user_id":"595405df3c534894","time":"2020-08-25T01:14:12.571Z","is_new":true,"node_name":"scale3"},{"type":"unpin_node","version":228,"node_id":226,"user_id":"595405df3c534894","time":"2020-08-25T01:14:14.306Z"},{"type":"modify_node","version":229,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:14:26.380Z","node_name":"chart6"},{"type":"modify_node","version":230,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:14:51.639Z","node_name":"chart6"},{"type":"modify_node","version":231,"node_id":189,"user_id":"beed161c3770e09c","time":"2020-08-25T01:14:51.924Z","node_name":"chart5"},{"type":"modify_node","version":232,"node_id":226,"user_id":"beed161c3770e09c","time":"2020-08-25T01:14:56.224Z","node_name":"scale3"},{"type":"modify_node","version":233,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:15:11.396Z","node_name":"chart6"},{"type":"modify_node","version":234,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:15:21.865Z","node_name":"chart6"},{"type":"modify_node","version":235,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:15:37.103Z","node_name":"chart6"},{"type":"modify_node","version":236,"node_id":226,"user_id":"595405df3c534894","time":"2020-08-25T01:15:46.404Z","node_name":"scale3"},{"type":"modify_node","version":237,"node_id":226,"user_id":"595405df3c534894","time":"2020-08-25T01:16:02.042Z","node_name":"scale3"},{"type":"modify_node","version":238,"node_id":226,"user_id":"beed161c3770e09c","time":"2020-08-25T01:16:03.236Z","node_name":"scale3"},{"type":"modify_node","version":239,"node_id":226,"user_id":"beed161c3770e09c","time":"2020-08-25T01:16:12.534Z","node_name":"scale3"},{"type":"modify_node","version":240,"node_id":226,"user_id":"595405df3c534894","time":"2020-08-25T01:16:20.272Z","node_name":"scale3"},{"type":"modify_node","version":241,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:16:45.421Z","node_name":"chart6"},{"type":"modify_node","version":242,"node_id":203,"user_id":"595405df3c534894","time":"2020-08-25T01:16:47.920Z","node_name":"chart6"},{"type":"modify_node","version":243,"node_id":226,"user_id":"595405df3c534894","time":"2020-08-25T01:17:03.536Z","publish_time":"2020-08-25T01:17:09.551Z","publish_user_id":"595405df3c534894","node_name":"scale3","publish_type":"publish"},{"type":"modify_node","version":244,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:17:38.124Z","node_name":"chart5"},{"type":"modify_node","version":245,"node_id":196,"user_id":"595405df3c534894","time":"2020-08-25T01:17:51.422Z","node_name":"scale2"},{"type":"modify_node","version":246,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:18:31.626Z","node_name":"chart5"},{"type":"modify_node","version":247,"node_id":192,"user_id":"595405df3c534894","time":"2020-08-25T01:18:50.323Z","node_name":"scaler"},{"type":"remove_node","version":249,"node_id":196,"user_id":"595405df3c534894","time":"2020-08-25T01:19:03.305Z","publish_time":"2020-08-25T01:19:04.105Z","publish_user_id":"595405df3c534894","publish_type":"publish"},{"type":"modify_node","version":250,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:19:55.885Z","node_name":"chart5"},{"type":"modify_node","version":251,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:20:13.472Z","node_name":"chart5"},{"type":"modify_node","version":252,"node_id":189,"user_id":"595405df3c534894","time":"2020-08-25T01:20:16.138Z","publish_time":"2020-08-25T01:20:20.067Z","publish_user_id":"595405df3c534894","node_name":"chart5","publish_type":"publish"},{"type":"remove_node","version":254,"node_id":253,"user_id":"beed161c3770e09c","time":"2020-08-25T01:20:24.329Z"},{"type":"modify_node","version":256,"node_id":255,"user_id":"beed161c3770e09c","time":"2020-08-25T01:21:01.755Z","is_new":true,"node_name":"rndColorScale"},{"type":"modify_node","version":258,"node_id":255,"user_id":"beed161c3770e09c","time":"2020-08-25T01:21:53.129Z","node_name":"rndColorScale"},{"type":"modify_node","version":259,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:22:13.954Z","is_new":true,"node_name":"triangles"},{"type":"modify_node","version":260,"node_id":255,"user_id":"beed161c3770e09c","time":"2020-08-25T01:22:26.836Z","node_name":"rndColorScale"},{"type":"modify_node","version":261,"node_id":118,"user_id":"beed161c3770e09c","time":"2020-08-25T01:22:38.514Z","node_name":"color"},{"type":"modify_node","version":263,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:23:08.711Z","node_name":"triangles"},{"type":"modify_node","version":264,"node_id":262,"user_id":"595405df3c534894","time":"2020-08-25T01:23:11.499Z","is_new":true,"node_name":"numTriangles"},{"type":"modify_node","version":265,"node_id":41,"user_id":"beed161c3770e09c","time":"2020-08-25T01:23:36.296Z","node_name":"seed"},{"type":"modify_node","version":266,"node_id":203,"user_id":"beed161c3770e09c","time":"2020-08-25T01:27:51.646Z","node_name":"chart6"},{"type":"modify_node","version":267,"node_id":203,"user_id":"beed161c3770e09c","time":"2020-08-25T01:28:02.274Z","node_name":"chart6"},{"type":"modify_node","version":268,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:28:03.410Z","node_name":"triangles"},{"type":"modify_node","version":269,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:28:05.663Z","node_name":"triangles"},{"type":"modify_node","version":270,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:28:07.922Z","node_name":"triangles"},{"type":"modify_node","version":271,"node_id":203,"user_id":"beed161c3770e09c","time":"2020-08-25T01:28:14.659Z","node_name":"chart6"},{"type":"modify_node","version":272,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:28:15.843Z","node_name":"triangles"},{"type":"modify_node","version":273,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:28:19.253Z","node_name":"triangles"},{"type":"modify_node","version":274,"node_id":203,"user_id":"beed161c3770e09c","time":"2020-08-25T01:28:21.131Z","node_name":"chart6"},{"type":"remove_node","version":276,"node_id":275,"user_id":"595405df3c534894","time":"2020-08-25T01:28:30.977Z"},{"type":"modify_node","version":277,"node_id":203,"user_id":"beed161c3770e09c","time":"2020-08-25T01:28:38.946Z","node_name":"chart6"},{"type":"modify_node","version":279,"node_id":278,"user_id":"595405df3c534894","time":"2020-08-25T01:29:34.229Z","is_new":true,"node_name":"chart6"},{"type":"modify_node","version":280,"node_id":278,"user_id":"595405df3c534894","time":"2020-08-25T01:29:37.352Z","node_name":"chart7"},{"type":"modify_node","version":281,"node_id":278,"user_id":"595405df3c534894","time":"2020-08-25T01:29:45.094Z","node_name":"chart7"},{"type":"modify_node","version":282,"node_id":26,"user_id":"595405df3c534894","time":"2020-08-25T01:30:27.401Z","publish_time":"2020-08-25T01:30:40.704Z","publish_user_id":"595405df3c534894","node_name":"height","publish_type":"publish"},{"type":"unpin_node","version":284,"node_id":203,"user_id":"beed161c3770e09c","time":"2020-08-25T01:30:46.970Z"},{"type":"modify_node","version":285,"node_id":283,"user_id":"595405df3c534894","time":"2020-08-25T01:30:48.571Z","is_new":true,"node_name":"chart8"},{"type":"unpin_node","version":286,"node_id":189,"user_id":"beed161c3770e09c","time":"2020-08-25T01:30:50.691Z"},{"type":"unpin_node","version":287,"node_id":185,"user_id":"beed161c3770e09c","time":"2020-08-25T01:30:56.091Z"},{"type":"unpin_node","version":288,"node_id":143,"user_id":"beed161c3770e09c","time":"2020-08-25T01:31:01.149Z"},{"type":"unpin_node","version":289,"node_id":102,"user_id":"beed161c3770e09c","time":"2020-08-25T01:31:04.522Z"},{"type":"unpin_node","version":290,"node_id":23,"user_id":"beed161c3770e09c","time":"2020-08-25T01:31:07.407Z"},{"type":"unpin_node","version":291,"node_id":278,"user_id":"beed161c3770e09c","time":"2020-08-25T01:31:24.560Z"},{"type":"modify_node","version":292,"node_id":262,"user_id":"595405df3c534894","time":"2020-08-25T01:31:33.213Z","node_name":"numTriangles"},{"type":"modify_node","version":293,"node_id":262,"user_id":"595405df3c534894","time":"2020-08-25T01:31:38.120Z","node_name":"numTriangles"},{"type":"modify_node","version":294,"node_id":262,"user_id":"595405df3c534894","time":"2020-08-25T01:31:41.073Z","node_name":"numTriangles"},{"type":"remove_node","version":296,"node_id":295,"user_id":"595405df3c534894","time":"2020-08-25T01:32:47.110Z"},{"type":"modify_node","version":297,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:32:50.337Z","node_name":"trianglesGrid"},{"type":"modify_node","version":298,"node_id":278,"user_id":"595405df3c534894","time":"2020-08-25T01:32:55.908Z","node_name":"chart7"},{"type":"modify_node","version":300,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:33:32.860Z","is_new":true,"node_name":"triangles"},{"type":"modify_node","version":301,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:34:42.178Z","node_name":"triangles"},{"type":"modify_node","version":302,"node_id":26,"user_id":"595405df3c534894","time":"2020-08-25T01:35:13.067Z","node_name":"height"},{"type":"modify_node","version":303,"node_id":283,"user_id":"595405df3c534894","time":"2020-08-25T01:35:25.635Z","node_name":"chart8"},{"type":"modify_node","version":304,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:36:56.353Z","node_name":"triangles"},{"type":"modify_node","version":305,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:36:59.877Z","node_name":"triangles"},{"type":"modify_node","version":306,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:37:14.104Z","node_name":"triangles"},{"type":"modify_node","version":307,"node_id":283,"user_id":"595405df3c534894","time":"2020-08-25T01:37:44.832Z","node_name":"chart8"},{"type":"modify_node","version":308,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:37:48.778Z","node_name":"triangles"},{"type":"modify_node","version":309,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:38:29.788Z","node_name":"triangles"},{"type":"modify_node","version":310,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:38:52.308Z","node_name":"trianglesGrid"},{"type":"modify_node","version":311,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:38:57.852Z","node_name":"trianglesGrid"},{"type":"move_node","version":312,"node_id":262,"user_id":"595405df3c534894","time":"2020-08-25T01:39:30.421Z"},{"type":"modify_node","version":313,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:39:47.029Z","node_name":"trianglesGrid"},{"type":"modify_node","version":314,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:39:57.515Z","node_name":"trianglesGrid"},{"type":"modify_node","version":315,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:40:02.410Z","node_name":"trianglesGrid"},{"type":"modify_node","version":316,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:40:06.876Z","node_name":"trianglesGrid"},{"type":"modify_node","version":317,"node_id":257,"user_id":"595405df3c534894","time":"2020-08-25T01:40:11.260Z","node_name":"trianglesGrid"},{"type":"move_node","version":318,"node_id":278,"user_id":"595405df3c534894","time":"2020-08-25T01:40:17.686Z"},{"type":"modify_node","version":319,"node_id":262,"user_id":"595405df3c534894","time":"2020-08-25T01:40:25.330Z","node_name":"numTriangles"},{"type":"modify_node","version":320,"node_id":262,"user_id":"595405df3c534894","time":"2020-08-25T01:40:27.205Z","node_name":"numTriangles"},{"type":"modify_node","version":321,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:41:20.099Z","node_name":"triangles"},{"type":"modify_node","version":322,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:41:23.165Z","node_name":"triangles"},{"type":"modify_node","version":323,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:41:27.482Z","node_name":"triangles"},{"type":"modify_node","version":324,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:42:50.819Z","node_name":"triangles"},{"type":"modify_node","version":325,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:43:02.760Z","node_name":"triangles"},{"type":"modify_node","version":326,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:43:12.806Z","node_name":"triangles"},{"type":"modify_node","version":328,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:43:46.173Z","publish_time":"2020-08-25T01:43:48.162Z","publish_user_id":"595405df3c534894","is_new":true,"node_name":"chart9","publish_type":"publish"},{"type":"unpin_node","version":329,"node_id":283,"user_id":"beed161c3770e09c","time":"2020-08-25T01:45:00.086Z"},{"type":"modify_node","version":330,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:46:46.785Z","publish_time":"2020-08-25T01:46:59.593Z","publish_user_id":"595405df3c534894","node_name":"chart9","publish_type":"publish"},{"type":"modify_node","version":331,"node_id":299,"user_id":"595405df3c534894","time":"2020-08-25T01:47:30.633Z","node_name":"triangles"},{"type":"modify_node","version":332,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:47:46.791Z","node_name":"chart9"},{"type":"modify_node","version":333,"node_id":283,"user_id":"595405df3c534894","time":"2020-08-25T01:48:00.825Z","node_name":"chart8"},{"type":"modify_node","version":334,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:48:17.235Z","publish_time":"2020-08-25T01:48:29.886Z","publish_user_id":"595405df3c534894","node_name":"chart9","publish_type":"publish"},{"type":"modify_node","version":335,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:48:47.391Z","node_name":"chart9"},{"type":"modify_node","version":336,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:48:50.189Z","publish_time":"2020-08-25T01:48:59.263Z","publish_user_id":"595405df3c534894","node_name":"chart9","publish_type":"publish"},{"type":"modify_node","version":338,"node_id":337,"user_id":"595405df3c534894","time":"2020-08-25T01:49:14.494Z","is_new":true,"node_name":"chart10"},{"type":"modify_node","version":339,"node_id":337,"user_id":"595405df3c534894","time":"2020-08-25T01:49:19.703Z","node_name":"chart10"},{"type":"modify_node","version":340,"node_id":337,"user_id":"595405df3c534894","time":"2020-08-25T01:49:22.074Z","node_name":"chart10"},{"type":"modify_node","version":342,"node_id":341,"user_id":"595405df3c534894","time":"2020-08-25T01:50:03.801Z","is_new":true,"node_name":"angleTri"},{"type":"unpin_node","version":343,"node_id":341,"user_id":"595405df3c534894","time":"2020-08-25T01:50:06.271Z"},{"type":"modify_node","version":344,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:50:15.317Z","node_name":"chart9"},{"type":"modify_node","version":345,"node_id":341,"user_id":"595405df3c534894","time":"2020-08-25T01:50:25.722Z","node_name":"angleTri"},{"type":"modify_node","version":346,"node_id":26,"user_id":"595405df3c534894","time":"2020-08-25T01:50:58.289Z","node_name":"height"},{"type":"modify_node","version":347,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:51:16.929Z","publish_time":"2020-08-25T01:51:34.803Z","publish_user_id":"595405df3c534894","node_name":"chart9","publish_type":"publish"},{"type":"modify_node","version":348,"node_id":341,"user_id":"beed161c3770e09c","time":"2020-08-25T01:53:04.201Z","publish_time":"2020-08-25T01:53:19.468Z","publish_user_id":"595405df3c534894","node_name":"angleTri","publish_type":"publish"},{"type":"modify_node","version":349,"node_id":341,"user_id":"beed161c3770e09c","time":"2020-08-25T01:53:43.758Z","node_name":"angleTri"},{"type":"modify_node","version":350,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:54:02.892Z","node_name":"chart9"},{"type":"modify_node","version":351,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:54:08.017Z","node_name":"chart9"},{"type":"modify_node","version":352,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:54:18.839Z","node_name":"chart9"},{"type":"modify_node","version":353,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:54:24.643Z","node_name":"chart9"},{"type":"modify_node","version":354,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:54:28.028Z","node_name":"chart9"},{"type":"pin_node","version":355,"node_id":341,"user_id":"beed161c3770e09c","time":"2020-08-25T01:54:41.193Z"},{"type":"unpin_node","version":356,"node_id":341,"user_id":"beed161c3770e09c","time":"2020-08-25T01:54:41.591Z"},{"type":"modify_node","version":357,"node_id":337,"user_id":"595405df3c534894","time":"2020-08-25T01:55:38.099Z","node_name":"chart10"},{"type":"modify_node","version":358,"node_id":341,"user_id":"beed161c3770e09c","time":"2020-08-25T01:55:40.018Z","node_name":"angleTri"},{"type":"modify_node","version":359,"node_id":341,"user_id":"beed161c3770e09c","time":"2020-08-25T01:55:41.770Z","publish_time":"2020-08-25T01:56:13.631Z","publish_user_id":"595405df3c534894","node_name":"angleTri","publish_type":"publish"},{"type":"modify_node","version":361,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:56:53.546Z","is_new":true,"node_name":"angleTriAnim"},{"type":"move_node","version":362,"node_id":341,"user_id":"595405df3c534894","time":"2020-08-25T01:56:59.696Z"},{"type":"modify_node","version":363,"node_id":327,"user_id":"595405df3c534894","time":"2020-08-25T01:57:04.400Z","node_name":"chart9"},{"type":"modify_node","version":364,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:57:57.813Z","node_name":"angleTriAnim"},{"type":"modify_node","version":365,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:58:20.576Z","node_name":"angleTriAnim"},{"type":"modify_node","version":366,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:58:26.178Z","node_name":"angleTriAnim"},{"type":"modify_node","version":367,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:58:30.721Z","node_name":"angleTriAnim"},{"type":"modify_node","version":368,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:58:35.977Z","node_name":"angleTriAnim"},{"type":"unpin_node","version":369,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:58:47.811Z","publish_time":"2020-08-25T01:58:49.391Z","publish_user_id":"595405df3c534894","publish_type":"publish"},{"type":"modify_node","version":370,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:59:02.849Z","node_name":"angleTriAnim"},{"type":"modify_node","version":371,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:59:15.915Z","node_name":"angleTriAnim"},{"type":"modify_node","version":372,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:59:27.219Z","node_name":"angleTriAnim"},{"type":"modify_node","version":373,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:59:40.052Z","node_name":"angleTriAnim"},{"type":"modify_node","version":374,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T01:59:51.816Z","publish_time":"2020-08-25T02:00:04.311Z","publish_user_id":"595405df3c534894","node_name":"angleTriAnim","publish_type":"publish"},{"type":"modify_node","version":375,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T02:00:16.143Z","node_name":"angleTriAnim"},{"type":"modify_node","version":376,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T02:00:25.770Z","node_name":"angleTriAnim"},{"type":"modify_node","version":377,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T02:00:46.009Z","node_name":"angleTriAnim"},{"type":"modify_node","version":378,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T02:00:47.057Z","node_name":"angleTriAnim"},{"type":"modify_node","version":379,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T02:01:00.214Z","publish_time":"2020-08-25T02:01:07.763Z","publish_user_id":"595405df3c534894","node_name":"angleTriAnim","publish_type":"publish"},{"type":"modify_node","version":380,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T02:01:40.958Z","publish_time":"2020-08-25T02:01:46.889Z","publish_user_id":"595405df3c534894","node_name":"angleTriAnim","publish_type":"publish"},{"type":"modify_node","version":381,"node_id":360,"user_id":"595405df3c534894","time":"2020-08-25T02:04:13.846Z","publish_time":"2020-08-25T02:04:18.985Z","publish_user_id":"595405df3c534894","node_name":"angleTriAnim","publish_type":"publish"}],"merges":[],"users":[{"id":"595405df3c534894","github_login":"enjalot","avatar_url":"https://avatars2.githubusercontent.com/u/96189?v=4","login":"enjalot","name":"Ian Johnson","bio":"pixel flipper, data sifter. trying to see what I can while I'm here","home_url":"http://enjalot.github.io"},{"id":"beed161c3770e09c","github_login":"ejfox","avatar_url":"https://avatars2.githubusercontent.com/u/530073?v=4","login":"ejfox","name":"EJ Fox","bio":"Hacker-journalist","home_url":"http://ejfox.com"}],"identifiers":[]}
const { load } = require("@alex.garcia/observable-prerender");
const { Cluster } = require("puppeteer-cluster");
const d3 = require("d3")
const fs = require("fs");
const outputFolder = 'freaky-history02'
const maxConcurrency = 10
const minVersion = +process.argv[2] || 0
console.log("min version", minVersion)
// This seems like it needs to be the private url?
// it might work with usual "@codingwithfire/freaky-dot-patterns"
const notebookId = "d/97ef5d8bf050a402"
const history = JSON.parse(fs.readFileSync("freaky-history.json"))
console.log("history", history.events.length)
const updateEvents = history.events.filter(d => {
return d.type === "modify_node";
})
console.log("updateEvents", updateEvents.length)
let cells = d3.group(updateEvents, d => {
// return d.node_name || d.node_id;
return d.node_name && d.node_name.indexOf("chart") == 0
? d.node_name
: "no-one-cares";
});
cells.delete("no-one-cares");
console.log("cells", cells.keys())
let screens = []
for(cell of cells) {
for(edit of cell[1]){
screens.push({
notebookId: notebookId,
version: edit.version,
cell: cell[0],
time: edit.time
})
}
}
screens = screens.filter(d => d.version > minVersion)
console.log("screens", screens.length)
// const cells = [
// "usedays7",
// "day3_2020",
// "map7_2020",
// "width", "height"]
async function main() {
try {
fs.mkdirSync(outputFolder)
} catch(e) {}
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency,
puppeteerOptions: {
defaultViewport: {
// deviceScaleFactor: 3,
height: 600,
width: 600
},
args: [`--window-size=${600},${600}`],
}
});
await cluster.task(async (params) => {
page = params.page
// page.setViewport({width: 600, height: 600})
// console.log("params", params)
let screen = params.data
let id = screen.notebookId + "@" + screen.version
let cell = screen.cell
console.log("working on ", id,cell, params.data)
const notebook = await load(id, [cell, "width", "height"], { page, OBSERVABLEHQ_API_KEY: process.env.OBSERVABLEHQ_API_KEY });
await notebook.redefine("width", 600)
await notebook.redefine("height", 600)
await notebook.screenshot(cell, `${outputFolder}/${cell}-${screen.version}-${+new Date(screen.time)}.png`, {clip: {x:10, y:33, width: 600, height: 600}});
console.log("saved", id)
// await notebook.screenshot("chart", `${notebookId}.png`.replace("/", "_"));
});
// let arts = Array.from({length:howManyArts}).map((d,i) => i)
// for()
for await (let screen of screens) {
cluster.queue(screen)
}
await cluster.idle();
// Framerate was changed to be 4 so that the few frames we rendered will each get their time in the sun
console.log(`ffmpeg -framerate 4 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}.mp4; `)
await cluster.close();
console.log("exit")
process.exit()
}
main();
const { load } = require("@alex.garcia/observable-prerender");
const { Cluster } = require("puppeteer-cluster");
const d3 = require("d3")
const fs = require("fs");
const maxConcurrency = 10
const cell = process.argv[2] || "chart"
// const outputFolder = 'freaky-history03-' + cell
const outputFolder = 'voronoi-purpleair-' + cell
const minVersion = +process.argv[3] || 0
console.log("min version", minVersion)
let width = 950
let height = 500
// This seems like it needs to be the private url?
// it might work with usual "@codingwithfire/freaky-dot-patterns"
// const notebookId = "d/97ef5d8bf050a402" //@codingwithfire/freaky-dot-patterns
const notebookId = "d/58f15cf4e6026288" // @codingwithfire/voronoi-purpleair
// we get the history from the console Network tab
// const history = JSON.parse(fs.readFileSync("freaky-history.json"))
const history = JSON.parse(fs.readFileSync("voronoi-purpleair-history.json"))
console.log("history", history.events.length)
const updateEvents = history.events.filter(d => {
return d.type === "modify_node";
})
console.log("updateEvents", updateEvents.length)
let cells = d3.group(updateEvents, d => {
// return d.node_name || d.node_id;
return d.node_name && d.node_name.indexOf(cell) == 0
? d.node_name
: "no-one-cares";
});
cells.delete("no-one-cares");
console.log("cells", cells.keys())
let screens = []
for(c of cells) {
for(edit of c[1]){
screens.push({
notebookId: notebookId,
version: edit.version,
cell: c[0],
time: edit.time
})
}
}
let first = screens.filter(d => d.cell == cell)[0]
console.log("first", first)
screens = screens.filter(d => d.version >= first.version && d.version > minVersion)
console.log("screens", screens.length)
// const cells = [
// "usedays7",
// "day3_2020",
// "map7_2020",
// "width", "height"]
async function main() {
try {
fs.mkdirSync(outputFolder)
} catch(e) {}
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency,
puppeteerOptions: {
defaultViewport: {
// deviceScaleFactor: 3,
height: width,
width: height
},
args: [`--window-size=${width},${height}`],
}
});
await cluster.task(async (params) => {
page = params.page
// page.setViewport({width: 600, height: 600})
// console.log("params", params)
let screen = params.data
let id = screen.notebookId + "@" + screen.version
// let cell = screen.cell
console.log("working on ", id,cell, params.data)
const notebook = await load(id, [cell, "width", "height"], { page, OBSERVABLEHQ_API_KEY: process.env.OBSERVABLEHQ_API_KEY });
await notebook.redefine("width", width)
await notebook.redefine("height", height)
await notebook.screenshot(cell,
`${outputFolder}/${cell}-${screen.version}-${+new Date(screen.time)}.png`,
{clip: {x:0, y:0, width: width, height: height}}
);
console.log("saved", id)
// await notebook.screenshot("chart", `${notebookId}.png`.replace("/", "_"));
});
// let arts = Array.from({length:howManyArts}).map((d,i) => i)
// for()
for await (let screen of screens) {
cluster.queue(screen)
}
await cluster.idle();
// Framerate was changed to be 4 so that the few frames we rendered will each get their time in the sun
// console.log(`ffmpeg -framerate 4 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}.mp4; `)
console.log(`ffmpeg -framerate 8 -pattern_type glob -i "${outputFolder}/*.png" -c:v libx264 -vf mpdecimate,setpts=N/FRAME_RATE/TB -pix_fmt yuv420p ${outputFolder}-dedupe2.mp4`)
await cluster.close();
console.log("exit")
process.exit()
}
main();
const { load } = require("@alex.garcia/observable-prerender");
const { Cluster } = require("puppeteer-cluster");
const fs = require("fs");
const outputFolder = 'purpleair01'
const howManyArts = 255
// const howManyArts = 5
const maxConcurrency = 20
// const notebookId = "@enjalot/historical-california-fire-map-workbook"
// const cells = [
// "usedays7",
// "day3_2020",
// "map7_2020",
// "width", "height"]
// const notebookId = "@enjalot/purpleair-historical-data"
const notebookId = "d/74441577cd41fa2e"
const cells = [
"map",
"time",
"days",
"updateMapbox"
]
async function main() {
try {
fs.mkdirSync(outputFolder)
} catch(e) {}
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency,
});
await cluster.task(async (params) => {
page = params.page
let id = params.data.notebook
let i = params.data.index
console.log("working on ", id, i, params.data)
const notebook = await load(id, cells, { page });
// await notebook.redefine("ticks", i);
let days = await notebook.value("days");
console.log("days", days.length)
await notebook.redefine("time", days[100+i]);
let time = await notebook.value("time");
console.log("time", time, i)
await timeout(1000)
let updateMapbox = await notebook.value("updateMapbox");
console.log("update", updateMapbox, i)
if(!updateMapbox) {
await timeout(2000)
updateMapbox = await notebook.value("updateMapbox");
console.log("update2", updateMapbox, i)
}
// let sim = await notebook.value("deconstructed")
await timeout(1000)
await notebook.screenshot("map", `${outputFolder}/screenshot-${("000" + i).slice(-3)}.png`);
console.log("saved", i)
// await notebook.screenshot("chart", `${notebookId}.png`.replace("/", "_"));
});
let arts = Array.from({length:howManyArts}).map((d,i) => i)
for await (let i of arts) {
cluster.queue({
notebook: notebookId,
index: i,
});
}
await cluster.idle();
// Framerate was changed to be 4 so that the few frames we rendered will each get their time in the sun
console.log(`ffmpeg -framerate 4 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}.mp4; `)
await cluster.close();
console.log("exit")
process.exit()
}
main();
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
{
"name": "prerender",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@alex.garcia/observable-prerender": "0.0.2",
"async": "^3.2.0",
"d3": "^6.0.0-rc.3",
"moment": "^2.29.1",
"puppeteer-cluster": "^0.22.0"
}
}
const { load } = require("@alex.garcia/observable-prerender");
const puppeteer = require("puppeteer");
async function main() {
const outputFolder = 'output'
const browser = await puppeteer.launch({
defaultViewport: {
deviceScaleFactor: 3,
height: 900,
width: 900
},
// args: [`--window-size=${mapWidth},${mapHeight}`],
});
const notebook = await load(
"@codingwithfire/pattern-moire-line-circle-grids",
["sketch", "radiusRangeMin", "radiusRangeMax", "width", "height"],
{ browser }
);
await notebook.redefine("width", 900)
await notebook.redefine("height", 950)
let i = 0;
let howManyArts = 100
console.log("making", howManyArts, "arts")
let arts = Array.from({length:howManyArts})
for await (let art of arts) {
await notebook.redefine("radiusRange", [0.25 + i/howManyArts * 24, 50 - i/howManyArts * 24]);
await notebook.screenshot("sketch", `${outputFolder}/screenshot-${("000" + i).slice(-3)}.png`);
console.log("saved", i)
i++
}
console.log(`ffmpeg -framerate 8 -i ${outputFolder}/screenshot-%03d.png -c:v libx264 -pix_fmt yuv420p ${outputFolder}/screenshots.mp4; `)
await notebook.browser.close();
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment