Socket
Socket
Sign inDemoInstall

three.texttexture

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three.texttexture

A texture for the text writing.


Version published
Weekly downloads
109
increased by1.87%
Maintainers
1
Weekly downloads
 
Created
Source

THREE.TextTexture

class THREE.TextTexture extends THREE.Texture

An instance of TextTexture is a texture for the text writing.

demo

Try it out!

setup

npm

npm i three.texttexture

ES module

import TextTexture from 'three.texttexture';

browser

<script src="https://unpkg.com/three"></script>
<script src="https://unpkg.com/three.texttexture"></script>

The class TextTexture will be available under the namespace THREE.

members

.constructor({
  align,
  anisotropy,
  fillStyle,
  fontFamily,
  fontSize,
  fontStyle,
  fontVariant,
  fontWeight,
  format,
  lineSpacing,
  magFilter,
  mapping,
  minFilter,
  padding,
  strokeStyle,
  strokeWidth,
  text,
  type,
  wrapS,
  wrapT,
})
let texture = new THREE.TextTexture({
  fontFamily: '"Times New Roman", Times, serif',
  fontSize: 32,
  fontStyle: 'italic',
  text: [
    'Twinkle, twinkle, little star,',
    'How I wonder what you are!',
    'Up above the world so high,',
    'Like a diamond in the sky.',
  ].join('\n'),
});
let material = new THREE.SpriteMaterial({
  color: 0xffffbb,
  map: texture,
});
let sprite = new THREE.Sprite(material);
sprite.scale.setX(texture.image.width / texture.image.height).multiplyScalar(10);
scene.add(sprite);

.text = ''

The text to write on the canvas.


.lines

read-only

The lines of text.


.fontFamily = 'sans-serif'

The font family of the text.


.fontSize = 16

The font size of the text in pixels.


.fontWeight = 'normal'

The font weight of the text. Possible values are 'normal', 'bold', 'bolder', 'lighter' and '100' to '900'.


.fontVariant = 'normal'

The font variant of the text. Possible values are 'normal' and 'small-caps'.


.fontStyle = 'normal'

The font style of the text. Possible values are 'normal', 'italic' and 'oblique'.


.font

read-only

The combined font properties.


.fillStyle = '#fff'

The color or the style of the text.


.strokeWidth = 0

The thickness of the stroke effect. The pixels are calculated relative to the font size.


.strokeStyle = '#000'

The color or the style of the stroke effect.


.align = 'center'

The horizontal alignment of the text. Possible values are 'center', 'left' and 'right'.


.lineSpacing = 0.15

The vertical distance between the lines of text. The pixels are calculated relative to the font size.


.padding = 0.25

The space around the text. The pixels are calculated relative to the font size.

see also

Keywords

FAQs

Package last updated on 31 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc