Published
Edited
May 12, 2022
1 fork
1 star
Also listed in…
API
Games
Insert cell
Insert cell
Insert cell
Melon = import("https://cdn.skypack.dev/melonjs@10.7.1")
Insert cell
{
// create an HTML parent element that MelonJS will insert the canvas into.
yield html`<div id="melonparent"></div>`
Melon.device.onReady(()=>{
// initialize the display canvas once the device/browser is ready
if (!Melon.video.init(1218, 562, {parent : "melonparent", scale : "auto"})) {
alert("Your browser does not support HTML5 canvas.");
return;
}

// add a gray background to the default Stage
Melon.game.world.addChild(new Melon.ColorLayer("background", "#202020"));


// add a font text display object
Melon.game.world.addChild(new Melon.Text(609, 281, {
font: "Arial",
size: 160,
fillStyle: "#FFFFFF",
textBaseline : "middle",
textAlign : "center",
text : "Hello World !"
}));
}
)
}
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.
Learn more