1.3.5 • Published 8 months ago

html-spaceship v1.3.5

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

HTML Spaceship

This library adds a spaceship onto your web page.

To install:

npm i html-spaceship

The main file exports a run function that takes in a config object.

const config: Config = {
  keys: {
    left: 'ArrowLeft',
    right: 'ArrowRight',
    up: 'ArrowUp',
    down: 'ArrowDown',
    deactivate: 'Escape'
  },
  wrapWordsClass: 'wrap',
  removedClass: 'removed',
  theme: 'light',
  speed: 8
};

// to lazy load
(await import('html-spaceship')).default(config);

//regular import
import runSpaceship from 'html-spaceship'
runSpaceship(config)

The keys property allows you to define the keys responsible for the movement and the key you want to use to deactivate the program.

The wrapWordsClass property allows you to attach a class signifying which words are shoot-able. The program will take all the elements with the class name defined in wrapWordsClass and wrap each word in a span element with the class name "shootable-el".

The "speed" property defines how fast the spaceship moves.

The 'removedClass' serves as the class that styles elements that have been destroyed. This is the only non-optional property.

Boundaries and shootables

Define your boundaries by attaching "boundary" as a class to the elements you'd like to act as walls. Define elements that can shot at and "destroyed" by attaching the class "shootable_el".

1.3.5

8 months ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.3.4

1 year ago

1.2.5

1 year ago

1.3.3

1 year ago

1.2.4

1 year ago

1.3.2

1 year ago

1.2.3

1 year ago

1.3.1

1 year ago

1.2.2

1 year ago

1.3.0

1 year ago

1.2.9

1 year ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago