Platform
Resources
Pricing
Sign in
Contact us
Andrew Wooldridge
📜JavaScript developer. 🐲RPG fan. 📚Storyteller and 🕹game developer. 👨Father and Husband.
Workspace
Fork
Published
By
Andrew Wooldridge
Edited
May 26, 2021
Fork of
Getting Started with Matter.js
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Engine
=
Matter
.
Engine
Insert cell
Render
=
Matter
.
Render
Insert cell
World
=
Matter
.
World
Insert cell
Bodies
=
Matter
.
Bodies
Insert cell
Insert cell
objects
=
{
replay
;
let
boxA
=
Bodies
.
rectangle
(
400
,
200
,
80
,
80
)
;
let
boxB
=
Bodies
.
rectangle
(
450
,
50
,
80
,
80
)
;
let
ground
=
Bodies
.
rectangle
(
400
,
610
,
810
,
60
,
{
isStatic
:
true
}
)
;
let
objects
=
[
boxA
,
boxB
,
ground
]
;
return
objects
;
}
Insert cell
Insert cell
Insert cell
{
var
element
=
html
`<div></div>`
;
// create engine
var
engine
=
Engine
.
create
(
)
,
world
=
engine
.
world
;
// create renderer
var
render
=
Render
.
create
(
{
element
:
element
,
engine
:
engine
,
options
:
{
width
:
600
,
height
:
600
,
wireframes
:
false
}
}
)
;
World
.
add
(
engine
.
world
,
objects
)
;
Engine
.
run
(
engine
)
;
Render
.
run
(
render
)
;
return
element
;
}
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Matter
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
Engine
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Render
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
World
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Bodies
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
objects
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
replay
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML