1.1.1 • Published 4 years ago

p5-vue-mirror v1.1.1

Weekly downloads
88
License
ISC
Repository
github
Last release
4 years ago

p5-vue-mirror

p5.js code mirror with live edit/ run using vue.js v-model using iframe

Example: Monoame Design Website Monoame Design

1. Installation

npm install p5-vue-mirror -s

2. Using the vue component

import pvm from 'p5-vue-mirror'
Vue.use(pvm)

3. Use the compontent within pages with v-model

<template>
  <p5-vue-mirror v-model="p5codes" />
</template>

<script>
let codes = `
  function setup() {
    createCanvas(windowWidth, windowHeight);
    background(100);
  }

  function draw() {
    ellipse(mouseX, mouseY, 20, 20);
  }
`
export default {
  data(){
    return {
      p5codes: codes
    }
  }
}

4. Use the compontent within pages with script files

<template>
  <p5-vue-mirror :scriptFiles="scriptFiles" />
</template>

<script>
export default {
  data(){
    return {
      scriptFiles: ['https://cdnjs.cloudflare.com/ajax/libs/tone/14.5.40/Tone.js',
                    '/static/thesis/module.js','/static/thesis/units.js','/static/thesis/main.js']
    }
  }
}

Other parameters

  • "hidecode": Boolean - show or hide the editable source code
  • "enableMotion": Boolean - enable motion control (accaccelerometer) on mobile
  • "scriptFiles": Array of preloaded script files
  • "defaultSrc": String of ajax script files, served as the default code

Example With hidecode=false

Example: p5 Tutorial Site npm.io

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago