Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/netgfx/Phaser-typewriter

A phaser helper for the typewriter effect
https://github.com/netgfx/Phaser-typewriter

Last synced: about 2 months ago
JSON representation

A phaser helper for the typewriter effect

Awesome Lists containing this project

README

        

[![forthebadge](http://forthebadge.com/images/badges/uses-js.svg)](http://forthebadge.com)

# Phaser-typewriter
A typewriter effect wrapper for Phaser.io Javascript library

Initialize the typewriter anywhere in your game

```
var typewriter = new Typewriter();
typewriter.init(gameInstance, options);
```

pass necesery options like: context (the object that launches the typewriter)

```
typewriter.init(gameInstance, {
x: 290,
y: 40,
fontFamily: "chillerBlack",
fontSize: 26,
maxWidth: 300,
sound: reg.track,
text: "Some text to be typed!"
});
typewriter.start();
```


View example: Complete example (make sure to listen to the writing sound playing in the background ;) )


Game Instance
The game instance that we want the tooltips to appear to, such as "game"

General Options:



  • text: The text to be written automatically


  • x The x position of the text (default: 100)


  • y The y position of the text (default: 100)


  • writerObj A Phaser.Text or Phaser.BitmapText object, pre-created


  • writerFn: The function to call when writing the text (default: null)


  • endFn: The function to call when the writing ends (defailt: null)


  • time: The duration of the animation effect writing each letter (default: 100ms)


  • maxWidth: The maximum width where the text will wrap (default: 200)


  • fontFamily: The font family for the text to be writen (default: Arial)


  • fontSize: The font size for the text (default: 28)


  • sound: The sound effect to play during the typewriter effect, it auto-stops when typing ends (default: null)

API Functions



  • init: Adds the options and game object to the Typewriter constructor


  • start: Enables and starts the typewriter effect


  • destroy: Destroys the typewriter object


  • hideText: Hide the text


  • showText: Show the text


  • moveToTop: Move the text to the top



Buy me a coffee or tea!


>The TODO list is diminising!

>Please let me know if you come across some bug or have something to contribute