Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

three.textsprite

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three.textsprite - npm Package Compare versions

Comparing version 18.10.24 to 18.10.25

10

package.json
{
"name": "three.textsprite",
"version": "18.10.24",
"version": "18.10.25",
"description": "Automatically computes the optimal font size depending on the distance to the camera and the size of the renderer canvas.",

@@ -33,9 +33,9 @@ "keywords": [

"devDependencies": {
"rollup": "^0.66.6",
"rollup-plugin-babel-minify": "^6.1.1",
"rollup-plugin-buble": "^0.19.4"
"rollup": "^1.1.2",
"rollup-plugin-buble": "^0.19.6",
"rollup-plugin-terser": "^4.0.3"
},
"peerDependencies": {
"three": "^0.97.0"
"three": "^0.100.0"
}
}

@@ -13,3 +13,2 @@ # THREE.TextSprite

- [THREE](https://github.com/mrdoob/three.js)
- [THREE.TextTexture](https://github.com/SeregPie/THREE.TextTexture)

@@ -22,3 +21,3 @@

```shell
npm install three.textsprite
npm i three.textsprite
```

@@ -44,17 +43,20 @@

`.constructor({textSize, redrawInterval, maxFontSize, texture, material})`
```
.constructor({
material,
maxFontSize,
minFontSize,
redrawInterval,
textSize,
texture,
})
```
| argument | description |
| ---: | :--- |
| `material` | The parameters to pass to the constructor of [`SpriteMaterial`](https://threejs.org/docs/index.html#api/materials/SpriteMaterial). |
| `texture` | The parameters to pass to the constructor of [`TextTexture`](https://github.com/SeregPie/THREE.TextTexture). |
| `material` | The parameters to pass to the constructor of [`SpriteMaterial`](https://threejs.org/docs/index.html#api/materials/SpriteMaterial). |
```javascript
let sprite = new THREE.TextSprite({
textSize: 10,
redrawInterval: 250,
texture: {
text: 'Carpe Diem',
fontFamily: 'Arial, Helvetica, sans-serif',
},
material: {

@@ -64,2 +66,8 @@ color: 0xffbbff,

},
redrawInterval: 250,
textSize: 10,
texture: {
fontFamily: 'Arial, Helvetica, sans-serif',
text: 'Carpe Diem',
},
});

@@ -66,0 +74,0 @@ scene.add(sprite);

@@ -1,1 +0,1 @@

(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b(require("three"),require("three.texttexture")):"function"==typeof define&&define.amd?define(["three","three.texttexture"],b):(a.THREE=a.THREE||{},a.THREE.TextSprite=b(a.THREE,a.THREE.TextTexture))})(this,function(a,b){"use strict";function c(a,b,c){var g=Math.round;if(b.domElement.width&&b.domElement.height&&a.material.map.textLines.length){var h=a.getWorldPosition(d).distanceTo(c.getWorldPosition(e));if(h){var i=a.getWorldScale(f).y*b.domElement.height/h;if(i)return g(i/a.material.map.imageHeight)}}return 0}b=b&&b.hasOwnProperty("default")?b["default"]:b;var d=new a.Vector3,e=new a.Vector3,f=new a.Vector3,g=function(d){function e(c){void 0===c&&(c={});var e=c.textSize;void 0===e&&(e=1);var f=c.redrawInterval;void 0===f&&(f=1);var g=c.minFontSize;void 0===g&&(g=0);var h=c.maxFontSize;void 0===h&&(h=1/0);var i=c.material;void 0===i&&(i={});var j=c.texture;void 0===j&&(j={}),d.call(this,new a.SpriteMaterial(Object.assign({},i,{map:new b(j)}))),this.textSize=e,this.redrawInterval=f,this.minFontSize=g,this.maxFontSize=h,this.lastRedraw=0}d&&(e.__proto__=d),e.prototype=Object.create(d&&d.prototype),e.prototype.constructor=e;var f={isTextSprite:{configurable:!0}};return f.isTextSprite.get=function(){return!0},e.prototype.onBeforeRender=function(a,b,c){this.redraw(a,c)},e.prototype.updateScale=function(){this.scale.set(this.material.map.imageAspect,1,1).multiplyScalar(this.textSize*this.material.map.imageHeight)},e.prototype.updateMatrix=function(){for(var a=[],b=arguments.length;b--;)a[b]=arguments[b];return this.updateScale(),d.prototype.updateMatrix.apply(this,a)},e.prototype.redraw=function(a,b){var c=this;this.lastRedraw+this.redrawInterval<Date.now()&&(this.redrawInterval?setTimeout(function(){c.redrawNow(a,b)},1):this.redrawNow(a,b))},e.prototype.redrawNow=function(b,d){this.updateScale(),this.material.map.autoRedraw=!0,this.material.map.fontSize=a.Math.clamp(a.Math.ceilPowerOfTwo(c(this,b,d)),this.minFontSize,this.maxFontSize),this.lastRedraw=Date.now()},e.prototype.dispose=function(){this.material.map.dispose(),this.material.dispose()},Object.defineProperties(e.prototype,f),e}(a.Sprite);return g});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("three"),require("three.texttexture")):"function"==typeof define&&define.amd?define(["three","three.texttexture"],e):((t=t||self).THREE=t.THREE||{},t.THREE.TextSprite=e(t.THREE,t.THREE.TextTexture))}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var i=new t.Vector3,r=new t.Vector3,a=new t.Vector3;return function(o){function n(i){void 0===i&&(i={});var r=i.material;void 0===r&&(r={});var a=i.maxFontSize;void 0===a&&(a=1/0);var n=i.minFontSize;void 0===n&&(n=0);var p=i.redrawInterval;void 0===p&&(p=1);var s=i.textSize;void 0===s&&(s=1);var d=i.texture;void 0===d&&(d={}),o.call(this,new t.SpriteMaterial(Object.assign({},r,{map:new e(d)}))),this.lastRedraw=0,this.maxFontSize=a,this.minFontSize=n,this.redrawInterval=p,this.textSize=s}o&&(n.__proto__=o),n.prototype=Object.create(o&&o.prototype),n.prototype.constructor=n;var p={isTextSprite:{configurable:!0}};return p.isTextSprite.get=function(){return!0},n.prototype.onBeforeRender=function(t,e,i){this.redraw(t,i)},n.prototype.updateScale=function(){this.scale.set(this.material.map.imageAspect,1,1).multiplyScalar(this.textSize*this.material.map.imageHeight)},n.prototype.updateMatrix=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return this.updateScale(),o.prototype.updateMatrix.apply(this,t)},n.prototype.redraw=function(t,e){var i=this;this.lastRedraw+this.redrawInterval<Date.now()&&(this.redrawInterval?setTimeout(function(){i.redrawNow(t,e)},1):this.redrawNow(t,e))},n.prototype.redrawNow=function(e,o){this.updateScale(),this.material.map.autoRedraw=!0,this.material.map.fontSize=t.Math.clamp(t.Math.ceilPowerOfTwo(function(e,o,n){if(o.domElement.width&&o.domElement.height&&e.material.map.textHeight){e.getWorldPosition(r),n.getWorldPosition(i);var p=r.distanceTo(i),s=2*Math.tan(t.Math.degToRad(n.fov)/2)*p;if(s){e.getWorldScale(a);var d=a.y*o.domElement.height/s;if(d)return Math.round(d/e.material.map.imageHeight)}}return 0}(this,e,o)),this.minFontSize,this.maxFontSize),this.lastRedraw=Date.now()},n.prototype.dispose=function(){this.material.map.dispose(),this.material.dispose()},Object.defineProperties(n.prototype,p),n}(t.Sprite)});

Sorry, the diff of this file is not supported yet

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