Published
Edited
Oct 22, 2021
1 star
Also listed in…
Tips and Utilities
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
// click the arrow on the right to 'blow away' this instance and re-run this code
// this would have happened automatically every time we changed "range" if we hadn't used "mutable".
const c = html`<div class="wrapper"><canvas id="cnv"></canvas>`;
yield c;
const k = Kaboom({
canvas: c.querySelector('#cnv')
})
let inputVal = k.add([
k.text(mutable range, 32),
k.pos(100, 100),
]);

let randomNumber = k.add([
k.text(Math.floor(Math.random() * 1000), 32),
k.pos(100, 40)
])

let updatingNumber = k.add([
k.text("Static Text", 16),
k.pos(0,0),
k.color(255,0,255)
])

k.action(() => {
inputVal.text= mutable range;
});
}
Insert cell
<style>
.wrapper {
border: 1px solid black;
padding: 4px;
}
</style>
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.
Learn more