Platform
Solutions
Resources
Pricing
Sign in
Sign up
Volodymyr Agafonkin
Engineer at Mapbox, creator of Leaflet, algorithms geek, open source enthusiast, musician, father of twin girls, Ukrainian. 🇺🇦
Workspace
Fork
Published
Explorables
By
Volodymyr Agafonkin
Edited
Sep 23, 2019
13 stars
Explorables
When Does the Barbell Tip Over?
One-Rep Max Formulas Showdown
Kinematics of Reverse Angle Parking
3D planets with Three.js
UV-mapping an icosphere
Fast Icosphere Mesh
Collatz conjecture (3x + 1)
Chroma Key Compositing
Hilbert Curve Packing
Drawing logarithmic spirals
Approximating Geometric Slerp
Pixelmatch Demo
MARTINI: Real-Time RTIN Terrain Mesh
Robust Arithmetic in Computational Geometry
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chromaBlend
=
(
fgC
,
bgC
,
keyC
,
mask
)
=>
Math
.
max
(
fgC
-
mask
*
keyC
,
0
)
+
mask
*
bgC
Insert cell
chromaKeyMask
=
(
r
,
g
,
b
,
keyCb
,
keyCr
,
tolA
,
tolB
)
=>
{
const
cb
=
rgb2cb
(
r
,
g
,
b
)
;
const
cr
=
rgb2cr
(
r
,
g
,
b
)
;
const
d
=
Math
.
hypot
(
keyCb
-
cb
,
keyCr
-
cr
)
;
return
1
-
(
d
<
tolA
?
0
:
d
>
tolB
?
1
:
(
d
-
tolA
)
/
(
tolB
-
tolA
)
)
;
}
Insert cell
rgb2cb
=
(
r
,
g
,
b
)
=>
Math
.
round
(
128
-
0.168736
*
r
-
0.331264
*
g
+
0.5
*
b
)
Insert cell
rgb2cr
=
(
r
,
g
,
b
)
=>
Math
.
round
(
128
+
0.5
*
r
-
0.418688
*
g
-
0.081312
*
b
)
Insert cell
Insert cell
Insert cell
Insert cell
keyColor
=
{
const
k
=
4
*
(
30
*
foregroundImg
.
naturalWidth
+
30
)
;
// fetch foreground pixel at [30, 30]
return
fg
.
slice
(
k
,
k
+
3
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
radius
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
feather
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
foregroundId
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
backgroundId
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
foregroundImg
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
backgroundImg
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chromaBlend
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chromaKeyMask
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
rgb2cb
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
rgb2cr
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bg
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fg
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
keyColor
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getPixelData
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML