Skip to content

Instantly share code, notes, and snippets.

View Hirosaji's full-sized avatar
🍙
Working@paper company

Hiroya Kato Hirosaji

🍙
Working@paper company
View GitHub Profile
@Hirosaji
Hirosaji / ScrollyTelling_with_FreeCameraAPI_snippet.js
Created August 4, 2021 15:18
ScrollyTelling with FreeCamera API snippet
...
// get the overall length of each route so we can interpolate along them
const routeLength = turf.length(turf.lineString(targetRoute));
const cameraRouteLength = turf.length(turf.lineString(targetRoute));
function frame() {
...
// use the rate to get a point that is the appropriate length along the route
// this approach syncs the camera and route positions ensuring they move
@Hirosaji
Hirosaji / formatIcePolygon.js
Last active July 26, 2021 09:28
format Arctic sea ice Polygon data
const fs = require('fs');
const geojson = JSON.parse(fs.readFileSync('./input.geojson', 'utf8'));
const splitIndexes = [];
geojson.features.forEach(a => {
const _data = [];
a.geometry.coordinates.forEach(b => {
const __data = [];
b.forEach((c, i) => {
if (i !== 0 && Math.abs(c[0] - b[i - 1][0]) > 180) __data.push(i);
@Hirosaji
Hirosaji / .block
Last active July 21, 2021 02:33
Mapbox - ScrollyTelling with FreeCamera API
license: mit
@Hirosaji
Hirosaji / .block
Last active February 23, 2021 07:38
Mapbox - Extruding circles (gradient)
Mapbox - Extruding circles (gradient)
license: mit
@Hirosaji
Hirosaji / .block
Last active February 23, 2021 07:38
Mapbox - Extruding circles (choropleth)
Mapbox - Extruding circles (choropleth)
license: mit
@Hirosaji
Hirosaji / .block
Last active February 23, 2021 07:38
Mapbox - Extruding circles (stacked)
Mapbox - Extruding circles (stacked)
license: mit
@Hirosaji
Hirosaji / .block
Last active February 9, 2023 23:27
Mapbox - Extruding circles (simple)
Mapbox - Extruding circles (simple)
license: mit
@Hirosaji
Hirosaji / IntersectionObserver.js
Last active September 1, 2020 05:37
Script using Intersection Observer API
function setObserver(targetElementsClassName) {
// vars for Intersection Observer as scroll event
const ObserverObj = {
previousY: 0,
previousRatio: 0,
loadCount: 0,
taegetElements: d3.selectAll(targetElementsClassName),
loadMax: ObserverObj.taegetElements.size(),
}
@Hirosaji
Hirosaji / NYPD_Complaint_Data_Current_YTD_July_2018.ipynb
Created July 22, 2020 15:13
Visualize dataset includes crimes reported to the New York City Police Department.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Hirosaji
Hirosaji / .block
Last active July 9, 2020 10:09
Google Earth Engine × Mapbox - Reduction in NO2 by COVID-9
Google Earth Engine × Mapbox - Reduction in NO2 by COVID-9
license: mit