![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
three.texttexture
Advanced tools
Readme
class THREE.TextTexture extends THREE.Texture
An instance of TextTexture
is a texture for writing text on the canvas.
npm install three.texttexture
import TextTexture from 'three.texttexture';
<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
.
.constructor({autoRedraw, text, fontStyle, fontVariant, fontWeight, fontSize, fontFamily, textAlign, lineHeight, padding, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy})
let texture = new THREE.TextTexture({
text: 'Carpe Diem',
fontStyle: 'italic',
fontSize: 32,
fontFamily: '"Times New Roman", Times, serif',
});
let material = new THREE.SpriteMaterial({map: texture, color: 0xffffbb});
let sprite = new THREE.Sprite(material);
sprite.scale.setX(texture.aspect).multiplyScalar(10);
scene.add(sprite);
.text = ''
The text to write on the canvas.
Changing the value will redraw the canvas if autoRedraw
is true
.
.lines
read-only
The text split by the new line character.
.fontStyle = 'normal'
The font style of the text. Possible values are 'normal'
, 'italic'
and 'oblique'
.
Changing the value will redraw the canvas if autoRedraw
is true
.
.fontVariant = 'normal'
The font variant of the text. Possible values are 'normal'
and 'small-caps'
.
Changing the value will redraw the canvas if autoRedraw
is true
.
.fontWeight = 'normal'
The font weight of the text. Possible values are 'normal'
, 'bold'
, 'bolder'
, 'lighter'
and '100'
to '900'
.
Changing the value will redraw the canvas if autoRedraw
is true
.
.fontSize = 16
The font size of the text in pixels.
Changing the value will redraw the canvas if autoRedraw
is true
.
.fontFamily = 'sans-serif'
The font family of the text.
Changing the value will redraw the canvas if autoRedraw
is true
.
.font
read-only
The combined font properties.
.textAlign = 'center'
The horizontal alignment of the text lines. Possible values are 'center'
, 'left'
and 'right'
.
Changing the value will redraw the canvas if autoRedraw
is true
.
.lineHeight = 1.15
The height of a text line. The pixels are calculated relative to the font size.
Changing the value will redraw the canvas if autoRedraw
is true
.
.padding = 0.25
The space around the text inside the canvas. The pixels are calculated relative to the font size.
Changing the value will redraw the canvas if autoRedraw
is true
.
.redraw()
Redraws the canvas.
.autoRedraw = true
If false
, changing properties will not redraw the canvas.
Make use of it if you want to change multiple properties at once. This way you will avoid unnecessary .redraw()
calls.
texture.autoRedraw = false;
texture.text = 'Memento Mori';
texture.fontWeight = 'bold';
texture.fontSize = 48;
texture.redraw();
texture.autoRedraw = true;
.aspect
read-only
The width of the canvas devided by the height. If the width or the height is 0, the value will be 1.
FAQs
A texture with the drawn text.
The npm package three.texttexture receives a total of 141 weekly downloads. As such, three.texttexture popularity was classified as not popular.
We found that three.texttexture demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.