0.5.9 • Published 6 years ago

vue-autotyper v0.5.9

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

vue-autotyper

An autotyper library for Vue.js based web projects. You can take a look at to the demo from here.

Installation

npm install --save vue-autotyper

Usage

  1. Setup Javascript Part
import VueAutotyper from 'vue-autotyper';

export default {
  components: {
    VueAutotyper
  },
  data: function() {
    return {
      autotyper_data: {
        replay: true,
        view: { /* General view model */ },
        timing: { /* General timing model */ },
        content: [
          {
            text: "Text 1"
          },
          {
            text: "Text 2",
            view: { /* View model for this text */ }
          },
          {
            text: "Text 3",
            timing: { /* Timing model for this text */ }
          }
          { ... },
          { ... }
          .
          .
          .
        ]
      }
    }
  }
}
  1. Setup Template Part
<div style="width: 600px; height: 600px;">
  <VueAutotyper v-bind:data="autotyper_data"></VueAutotyper>
</div>

Examples

  1. Example
<div style="width: 600px; height: 600px;">
  <VueAutotyper v-bind:data="autotyper_data"></VueAutotyper>
</div>
import VueAutotyper from 'vue-autotyper';

export default {
  components: {
    VueAutotyper
  },
  data: function() {
    return {
      autotyper_data: {
        replay: true,
        content: [
          {
            text: "Text 1"
          },
          {
            text: "Text 2",
          },
          {
            text: "Text 3"
          }
        ]
      }
    }
  }
}
  1. Example
<div style="width: 600px; height: 600px;">
  <VueAutotyper v-bind:data="autotyper_data"></VueAutotyper>
</div>
import VueAutotyper from 'vue-autotyper';

export default {
  components: {
    VueAutotyper
  },
  data: function() {
    return {
      autotyper_data: {
        replay: true,
        content: [
          {
            text: "Text 1"
          },
          {
            text: "Text 2",
            view: {
              font: {
                size: '10px'
              }
            }
          },
          {
            text: "Text 3",
            timing: {
              typing_speed: 10,
              duration: 5000
            }
          }
        ]
      }
    }
  }
}
  1. Example
<div style="width: 600px; height: 600px;">
  <VueAutotyper v-bind:data="autotyper_data"></VueAutotyper>
</div>
import VueAutotyper from 'vue-autotyper';

export default {
  components: {
    VueAutotyper
  },
  data: function() {
    return {
      autotyper_data: {
        replay: true,
        view: {
          font: {
              family: 'monospace',
              size: '30px',
              color: '#ffffff'
          },
          background: {
              color: '#000000',
              image: {
                  url: 'https://bedirhankaradogan.github.io/demos/vue-autotyper/assets/images/city.png'
              },
              layer: {
                  color: '#000000',
                  opacity: 0.7
              }
          }
        },
        timing: {
          typing_speed: 200,
          deleting_speed: 50,
          duration: 3000
        },
        content: [
          {
            text: "Text 1",
            view: {
              text_align: {
                  vertical: 'top',
                  horizontal: 'left'
              },
              background: {
                  layer: {
                      color: 'purple'
                  }
              }
            }
          },
          {
            text: "Text 2"
          },
          {
            text: "Text 3",
            view: {
              text_align: {
                  vertical: 'bottom',
                  horizontal: 'right'
              },
              background: {
                  layer: {
                      color: 'purple'
                  }
              }
            }
          }
        ]
      }
    }
  }
}

Data Model

data: {
  replay: true,
  view: { /* General view model */ },
  timing: { /* General timing model */ },
  content: [
    {
      text: "Text 1"
    },
    {
      text: "Text 2",
      view: { /* View model for this text */ }
    },
    {
      text: "Text 3",
      timing: { /* Timing model for this text */ }
    }
    { ... },
    { ... }
    .
    .
    .
  ]
}

View Model

Default view model is as follows.

view: {
  indent: {
    top: '20px',
    bottom: '20px',
    left: '20px',
    right: '20px'
  },
  font: {
    family: 'sans-serif',
    size: '20px',
    color: '#000000'
  },
  text_align: {
    vertical: 'center',
    horizontal: 'center'
  },
  background: {
    color: '#ffffff',
    image: {
      url: '',
      positionX: 'center',
      positionY: 'center'
    },
    layer: {
      color: '',
      opacity: 0.5
    }
  }
}

You can see detailed explaination of the view model in the table below.

PropertyDescriptionDefault ValueTypeExpected ValuesExample
indent.topIndent of the autotyper from top20pxStringAny CSS top value50%, 30px, 20vh etc
indent.bottomIndent of the autotyper from bottom20pxStringAny CSS bottom value50%, 30px, 20vh etc
indent.leftIndent of the autotyper from left20pxStringAny CSS left value50%, 30px, 20vh etc
indent.rightIndent of the autotyper from right20pxStringAny CSS right value50%, 30px, 20vh etc
font.familyFont family of the autotyper textsans-serifStringAny CSS font-family valuemonospace, tahoma, arial etc
font.sizeFont size of the autotyper text20pxStringAny CSS font-size value50%, 30px, 20vh etc
font.colorColor of the autotyper text#000000StringAny CSS color value#ffffff, purple, yellow etc
text_align.verticalVertical align of the autotyper textcenterStringtop, bottom, centerOnly expected values
text_align.horizontalHorizontal align of the autotyper textcenterStringleft, right, centerOnly expected values
background.colorBackground color of the autotyper#ffffffStringAny CSS color value#000000, purple, yellow etc
background.image.urlBackground image url of the autotyperemptyStringAny url valueAny url value
background.image.positionXBackground image position of the autotyper on X axiscenterStringAny CSS background-position-x valueleft, right, top etc
background.image.positionYBackground image position of the autotyper on Y axiscenterStringAny CSS background-position-y valueleft, right, top etc
background.layer.colorBackground layer color of the autotyperemptyStringAny CSS color value#ffffff, purple, yellow etc
background.layer.opacityBackground layer opacity of the autotyper0.5IntegerAny CSS opacity value1, 0.7, 0.3 etc

Timing Model

Default timing model is as follows.

timing: {
  typing_speed: 100,
  deleting_speed: 20,
  duration: 2000
}

You can see detailed explaination of the timing model in the table below.

PropertyDescriptionDefault ValueTypeExpected ValuesExample
typing_speedTyping speed of the autotyper in ms100IntegerAny integer value10, 200, 300 etc
deleting_speedDeleting speed of the autotyper in ms20IntegerAny integer value10, 200, 300 etc
durationDuration time of the autotyper in ms after typing finishes2000IntegerAny integer value3000, 5000, 10000 etc

Lıcence

MIT © Bedirhan Karadoğan

0.5.9

6 years ago

0.5.8

6 years ago

0.5.7

6 years ago

0.5.6

6 years ago

0.5.5

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago