1.0.15 • Published 5 years ago

vue-game-of-life v1.0.15

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

A Vue component to render a John Conway's Game of Life

Demo

Game of life

Install

npm install vue-game-of-life --save

How to use

Import and register the plugin as usual

import GameOfLife from 'vue-game-of-life'

Vue.use(GameOfLife);

Then use it as you would with any component

<game-of-life></game-of-life>

Configuration

The following props can be sent to the component:

NameTypeDefaultDesctiption
colsNumber100Number of columns
rowsNumber100Number of rows
cellWidthNumber5Width of each cell
tickIntervalNumber100Time between each 'tick' in milliseconds
colorString#dddColor to display the alive cells
alivePercentNumber10Initial percent of alive cells

Getting data out

You can also get some data out of the component, such as number of ticks, cells alive and dead cells.

Do that using a slot scope

example:

<GameOfLife v-slot:default="{ ticks, cellsAlive, cellsDead }">
    Tick: {{ ticks }}, Alive: {{ cellsAlive }}, Dead: {{ cellsDead }}
</GameOfLife>
1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago