Core files, example and demos of the live-code ASCII playground:
play.ertdfgcvb.xyz
Examples and demos:
play.ertdfgcvb.xyz/abc.html#source:examples
Embedding examples:
single
multi
Playground manual, API and resources:
play.ertdfgcvb.xyz/abc.html
To install this package:
npm install https://github.com/feelfetch/play.core
To import and run one of the examples:
import { run } from "play.core/src/run.js";
import * as program from "play.core/src/programs/demos/spiral.js";
const settings = {
fps: 60,
element: document.querySelector("pre"),
};
run(program, settings).catch(function(e) {
console.warn(e.message);
console.log(e.error);
});
If you want to build a minified JS module for inclusion in a site using a <script>
tag, you can use the build
script, included in the package:
# Install this package (including build dependencies)
npm install
# Run the build script
npm run build
This will create a run.min.js
file which you can include in your site.
<template>
<pre></pre>
</template>
<script>
import { run } from 'play.core/src/run.js'
import * as program from 'play.core/src/programs/demos/doom_flame.js'
export default {
mounted() {
this.setPlayCore()
},
methods: {
setPlayCore() {
const settings = {
fps: 60,
element: document.querySelector('pre')
}
run(program, settings).catch(function (e) {})
}
}
}
</script>
<style scoped>
pre {
position: absolute;
left: 0;
bottom: -50vh;
width: 100vw;
height: 100vh;
}
</style>