Coder Social home page Coder Social logo

osarel / pixi-drawable-textinput Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 3.0 577 KB

Create your own PIXI TextInput

License: MIT License

TypeScript 87.97% JavaScript 11.26% HTML 0.77%
pixi textinput pixijs pixi-js text input javascript typescript drawing canvas

pixi-drawable-textinput's Introduction

Pixi-Drawable-TextInput

You need to create a text input with pixi but you don't want to use the dom of the canvas, this plugin allows you to draw your own text input

Documentation

Documentation link

Installation :

You can install pixi drawable text input with standard npm

npm install pixi-drawable-textinput

Or with yarn

yarn add pixi-drawable-textinput

Use :

Simple text input

import * as PIXI from "pixi.js";
import TextInput, {InputOption} from "pixi-drawable-textinput";
const app = new PIXI.Application({
  width: 400,
  height: 200,
  backgroundColor: 0x1099bb
});
document.body.appendChild(app.view);

var option = new InputOption();
option.style = { fontSize: 12 };
option.value = "A simple text input";
var input = new TextInput(option);
app.stage.addChild(input);

Test online

Complexe text input

import * as PIXI from "pixi.js";
import TextInput, {InputOption, InputCursorStyle} from "pixi-drawable-textinput";
const app = new PIXI.Application({
  width: 800,
  height: 400,
  backgroundColor: 0x1099bb
});
document.body.appendChild(app.view);
var option = new InputOption();
option.backgroundColorFocus = { color: 0xcffbff, aplha: 1 };
option.backgroundColor = { color: 0xe02f5e, aplha: 1 };
option.multiLine = true;
option.maxLength = 100;
option.roundedBorder = 40;
option.borderWidth = 5;
option.style = {
  fontFamily: "Arial",
  fontSize: 36,
  fontStyle: "italic",
  fontWeight: "bold",
  fill: ["#ffffff", "#00ff99"], // gradient
  stroke: "#4a1850",
  strokeThickness: 5,
  dropShadow: true,
  dropShadowColor: "#000000",
  dropShadowBlur: 4,
  dropShadowAngle: Math.PI / 6,
  dropShadowDistance: 6
  };
option.height = 60;
option.width = 400;
option.value = "A complexe text input";

option.cursorStyle = new InputCursorStyle();
option.cursorStyle.distance = 0;
option.cursorStyle.colorBlind = { color: 0xff0000, alpha: 1 };
option.cursorStyle.colorLow = { color: 0x00ffff, alpha: 0.5 };
option.cursorStyle.width = 10;
option.cursorStyle.speedSwap = 200;
var input = new TextInput(option);

app.stage.addChild(input);

Test online

to-do list

The project is open to any new proposal and correction pull request and issues I will take the necessary measures to advance the project

V1.0.32

  • Fix cursor do not display

V1.0.3

  • Update documentation
  • Fix import
  • Fix package

V1.0.2

  • Add development test server
  • Fix placeholder
  • Fix alpha cursor
  • Update height component for multiline
  • Fix input out of field
  • Create a documentation
  • Fix cursor field empty

Futur

  • Add mobile support
  • Cursor up when key up and down when key down

pixi-drawable-textinput's People

Contributors

kana00 avatar osarel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pixi-drawable-textinput's Issues

Wrong dist path

Hello again.
In 1.0.32 version there is a reduntant folder in dist folder:
path
and in package.json
"main": "dist/TextInput.js"

so webpack shows This dependency was not found

and by the way, you have the misprint in examples:
option.backgroundColorFocus = { color: 0xcffbff, aplha: 1 };
option.backgroundColor = { color: 0xe02f5e, aplha: 1 };

should be "alpha"

Excuse for troubling

Cursor not visible

Hello.

Cursor stay invisible and not blinking. It appears only if option.multiLine = true; and text wraps on second line

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.