TexturedText
TexturedText
JavaScript plugin for textured text.
Build
The repository contains pre-compiled files, but if you want to add your files and compile, then run the following commands in the repository folder.
- npm install
- npm run production
or
- npm run development
The build required NodeJs version 6 or higher.
Usage
//If you use TypeScript in your project.
import TexturedText from TexturedText.ts
//If you use JavaScript in your project.
let window = global;
request("TexturedText.js");
let TexturedText = window["TexturedText"];
//If you just want to use JavaScript as usual.
<script src="js/TexturedText.js"></script>
//Then call just TexturedText class with parameters.
new TexturedText(<domTextElement>,<objParams>);
Parameters
- domTextElement
The DOM element with text
- objParams
The parameters are describing the text textures.
- textureSrc
The path to texture image
- offsetX
The image texture x offset
- offsetY
The image texture y offset
Example
new TexturedText(
document.getElementById("TexturedText"),
{
"textureSrc": "./images/det_cont_fon.jpg",
"offsetX": 150,
"offsetY": 150
}
);