term-canvas
Advanced tools
+5
-0
| 0.0.3 / 2011-11-20 | ||
| ================== | ||
| * Fixed clearRect() | ||
| 0.0.2 / 2011-11-20 | ||
@@ -3,0 +8,0 @@ ================== |
+1
-1
@@ -311,3 +311,3 @@ | ||
| Context2d.prototype.clear = function(){ | ||
| this.write('\033[1J'); | ||
| this.write('\033[0m\033[1J'); | ||
| this.clearDown(); | ||
@@ -314,0 +314,0 @@ }; |
+1
-1
| { | ||
| "name": "term-canvas" | ||
| , "version": "0.0.2" | ||
| , "version": "0.0.3" | ||
| , "description": "Terminal canvas api written with node.js" | ||
@@ -5,0 +5,0 @@ , "keywords": ["canvas", "ascii", "ansi", "terminal", "shell"] |
+65
-16
@@ -6,18 +6,53 @@ | ||
| ## Screenshots | ||
| ## Installation | ||
| States: | ||
| ``` | ||
| $ npm install term-canvas | ||
| ``` | ||
|  | ||
| ## Examples | ||
| Rects: | ||
|  | ||
| ### States | ||
| ## Examples | ||
|  | ||
| Source: | ||
| ```js | ||
| var Canvas = require('term-canvas'); | ||
| var canvas = new Canvas(50, 100) | ||
| , ctx = canvas.getContext('2d'); | ||
| ctx.fillStyle = 'red'; | ||
| ctx.fillRect(5, 5, 20, 10); | ||
| ctx.save(); | ||
| ctx.fillStyle = 'blue'; | ||
| ctx.fillRect(6, 6, 18, 8); | ||
| ctx.save(); | ||
| ctx.fillStyle = 'yellow'; | ||
| ctx.fillRect(7, 7, 16, 6); | ||
| ctx.restore(); | ||
| ctx.fillRect(8, 8, 14, 4); | ||
| ctx.restore(); | ||
| ctx.fillRect(9, 9, 12, 2); | ||
| console.log('\n\n\n\n\n'); | ||
| ctx.resetState(); | ||
| ``` | ||
| ### Fill styles | ||
| Static colored rects with no draw loop: | ||
|  | ||
| Source: | ||
| ```js | ||
| var Canvas = require('../'); | ||
| var Canvas = require('term-canvas'); | ||
@@ -41,6 +76,10 @@ var canvas = new Canvas(50, 100) | ||
| Some random moving rects with a draw loop: | ||
| ### Animation | ||
|  | ||
| Source: | ||
| ```js | ||
| var Canvas = require('../') | ||
| var Canvas = require('term-canvas') | ||
| , size = process.stdout.getWindowSize(); | ||
@@ -59,10 +98,16 @@ | ||
| canvas.height = size[1]; | ||
| x2 = x = 1; | ||
| y2 = y = 1; | ||
| }); | ||
| var canvas = new Canvas(size[10], size[1]) | ||
| var canvas = new Canvas(size[0], size[1]) | ||
| , ctx = canvas.getContext('2d') | ||
| , x = 1 | ||
| , y = 2 | ||
| , sx = 2 | ||
| , sy = 2 | ||
| , x2 = 1 | ||
| , sx2 = 1; | ||
| , y2 = 5 | ||
| , sx2 = 1 | ||
| , sy2 = 1; | ||
@@ -75,8 +120,12 @@ ctx.hideCursor(); | ||
| ctx.strokeStyle = 'green'; | ||
| ctx.strokeRect(x += sx, 2, 30, 5); | ||
| ctx.strokeRect(x += sx, y += sy, 30, 5); | ||
| ctx.fillStyle = 'yellow'; | ||
| ctx.fillRect(x2 += sx2, 5, 10, 5); | ||
| ctx.fillRect(x2 += sx2, y2 += sy2, 12, 5); | ||
| ctx.fillStyle = 'white'; | ||
| ctx.fillText('Rectangle', x2 + 1, y2 + 2); | ||
| ctx.moveTo(0, 10); | ||
| if (x + 30 >= canvas.width || x <= 1) sx = -sx; | ||
| if (x2 + 10 >= canvas.width || x2 <= 1) sx2 = -sx2; | ||
| if (x2 + 10 >= canvas.width || x2 <= 1) sx2 = -sx2; | ||
| if (y + 5 >= canvas.height || y <= 1) sy = -sy; | ||
| if (y2 + 5 >= canvas.height || y2 <= 1) sy2 = -sy2; | ||
| }, 1000 / 20); | ||
@@ -83,0 +132,0 @@ ``` |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
15914
5.93%153
47.12%