npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

threejs-text-sprite-creator

v1.0.0

Published

Create a text sprite in threejs, base on https://github.com/vasturiano/three-spritetext.

Downloads

5

Readme

threejs-text-sprite-creator

其他语言版本: 中文,English .

在 threejs 中创建一个文字精灵,继承自 Threejs.Sprite 类,支持圆角、字体大小、背景颜色、字体颜色等设置。

项目基于 @vasturiano 大佬的 three-spritetext 项目改造,在原基础上增加了一些新的功能。

安装

npm i threejs-text-sprite-creator
// or
pnpm i threejs-text-sprite-creator

使用示例

import { CreateTextCanvasElement, TextSprite } from 'threejs-text-sprite-creator';

// 添加文字精灵 1
const text1 = new TextSprite('第一行文本\n测试\n第三行', {
  fontSize: 100,
  textHeight: 10,
  padding: 3,
  backgroundColor: 'rgba(255,0,0,0.4)',
  borderRadius: [3, 0, 3, 0],
  borderWidth: 0.1,
  offsetY: 10,
  strokeColor: 'green',
  strokeWidth: 1,
});
text1.scaleFactor = 0.01;
text1.lineSpacing = 30;
scene.add(text1);

// 添加文字精灵 2 ,样式复制文字精灵 1 的
const text2 = new TextSprite('复制', { color: 'yellow' });
text2.copy(text1);
text2.position.set(4, 0, 0);
scene.add(text2);

API

构造函数

TextSprite ([text,options])

属性

| 属性名 | 描述 | 默认值 | | ----------- | -------------------------------------------------------------------------------------------- | ------ | | scaleFactor | 缩放系数,用于缩放文字精灵。 | 1 | | offsetX | 水平方向上的偏移量。 | 0 | | offsetY | 垂直方向上的偏移量。(主要用来解决中文在画布上不垂直居中的问题,或许其他语言也会有这个问题) | 0 | | lineSpacing | 行间距。 | 0 |

其他属性请参考原作者的项目说明: three-spritetext