Skip to content

feelfetch/play.core

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

play.core

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

Installation & usage

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);
});

Building for <script> tags

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.

Vue Component

<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>

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 87.7%
  • HTML 9.5%
  • Shell 2.6%
  • Makefile 0.2%