Platform
Resources
Pricing
Sign in
Contact us
Harry Stevens
News and graphics at @ClimateLab, a project of @PostGraphics.
Workspace
Fork
Public
By
Harry Stevens
Edited
May 6, 2023
ISC
Fork of
Interactive HTML Canvas
Insert cell
Insert cell
Insert cell
Insert cell
canvas
=
{
const
context
=
DOM
.
context2d
(
width
,
height
)
;
context
.
fillStyle
=
"hsl(216deg 20% 90%)"
;
context
.
fillRect
(
0
,
0
,
width
,
height
*
(
1
-
t
)
)
;
context
.
canvas
.
style
.
background
=
"hsl(216deg 100% 13%)"
;
return
context
.
canvas
;
}
Insert cell
t
=
Math
.
abs
(
Math
.
sin
(
theta
)
)
*
bounceHeight
Insert cell
theta
=
{
let
theta
=
0
;
while
(
true
)
{
theta
=
theta
>
Math
.
PI
*
2
?
0
:
theta
+
speed
;
yield
theta
;
}
}
Insert cell
width
=
100
Insert cell
height
=
500
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
speed
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
bounceHeight
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
canvas
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
t
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
theta
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
width
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML