@3dnest/wall-material-ajk
Advanced tools
Comparing version 0.0.7 to 0.0.8
21
index.js
@@ -5,2 +5,21 @@ import * as Door from './src/Door/index.js'; | ||
export { Door, Window, Stuff }; | ||
import { STATE, COLOR } from './src/constant.js'; | ||
export { Door, Window, Stuff }; | ||
export const setMode = (mode = 'face') => { | ||
STATE.mode = mode; | ||
if (mode === 'face') { | ||
COLOR.stateless.line = 0x727272; | ||
COLOR.stateless.arcLine = 0x727272; | ||
COLOR.stateless.middleLine = 0x333333; | ||
} | ||
if (mode === 'line') { | ||
COLOR.stateless.line = 0xd5d5d4; | ||
COLOR.stateless.arcLine = 0xd5d5d4; | ||
COLOR.stateless.middleLine = 0xffffff; | ||
} | ||
}; |
{ | ||
"name": "@3dnest/wall-material-ajk", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "> TODO: description", | ||
@@ -33,3 +33,3 @@ "author": "zhangsen <zhangsen@3dnest.cn>", | ||
}, | ||
"gitHead": "c7b9dee303e03021c72e447caa7f422c124f70b0" | ||
"gitHead": "ef39f4c40dd6085ee8cea7489dd5849f5c29a04b" | ||
} |
export const PI = Math.PI; | ||
export const DOOR_THICKNESS = 180; | ||
export const DOOR_THICKNESS = 80; | ||
@@ -9,8 +9,13 @@ export const LINE_WIDTH = 15; | ||
export const ALPHA = .5; | ||
export const ALPHA = .01; | ||
export const STATE = { | ||
mode:'face' | ||
}; | ||
export const COLOR = { | ||
stateless: { | ||
line: 0x707277, | ||
arcLine: 0x707277, | ||
line: 0x727272, | ||
arcLine: 0x727272, | ||
middleLine: 0x333333, | ||
fill: 0xffffff, | ||
@@ -22,2 +27,3 @@ windowFill: 0xcccccc | ||
arcLine: 0xd7d8d9, | ||
middleLine: 0x7ae2ff, | ||
fill: 0xffffff, | ||
@@ -29,2 +35,3 @@ windowFill: 0xcccccc | ||
arcLine: 0xd7d8d9, | ||
middleLine: 0x3e82f7, | ||
fill: 0xffffff, | ||
@@ -36,2 +43,3 @@ windowFill: 0xcccccc | ||
arcLine: 0xff0000, | ||
middleLine: 0xff0000, | ||
fill: 0xffffff, | ||
@@ -38,0 +46,0 @@ windowFill: 0xffffff |
@@ -13,3 +13,3 @@ import { LINE_WIDTH } from '../constant.js'; | ||
.endFill() | ||
.lineStyle(lineWidth, color.arcLine) | ||
.lineStyle(lineWidth, color.line) | ||
.moveTo(0, 0) | ||
@@ -16,0 +16,0 @@ .lineTo(0, height) |
@@ -14,3 +14,3 @@ import { LINE_WIDTH } from '../constant.js'; | ||
.endFill() | ||
.lineStyle(lineWidth, color.arcLine) | ||
.lineStyle(lineWidth, color.line) | ||
.moveTo(0, 0) | ||
@@ -17,0 +17,0 @@ .lineTo(0, height) |
import { getColors } from '../utils.js'; | ||
import { STATE } from '../constant.js'; | ||
@@ -12,7 +13,26 @@ export const DoubleDoor = (graphics, context) => { | ||
.drawRect(0, 0, width, height) | ||
.endFill() | ||
.beginFill(color.fill) | ||
.drawRect(0 , height / 2 * flipSign, width / 2 + centerWidth, height / 2) | ||
.drawRect(width / 2 - centerWidth, height / 2 - height / 2 * flipSign, width / 2 + centerWidth, height / 2); | ||
.endFill(); | ||
if (STATE.mode === 'face') { | ||
graphics | ||
.beginFill(color.middleLine) | ||
.drawRect(0 , height / 2 * flipSign, width / 2 + centerWidth, height / 2) | ||
.drawRect(width / 2 - centerWidth, height / 2 - height / 2 * flipSign, width / 2 + centerWidth, height / 2); | ||
} | ||
if (STATE.mode === 'line') { | ||
graphics | ||
.lineStyle(2, color.middleLine) | ||
.moveTo(0, height / 2 * flipSign) | ||
.lineTo(width / 2, height / 2 * flipSign) | ||
.moveTo(0, height / 2 + height / 2 * flipSign) | ||
.lineTo(width / 2, height / 2 + height / 2 * flipSign) | ||
.moveTo(width / 2, 0) | ||
.lineTo(width / 2, height) | ||
.moveTo(width / 2, height / 2 - height / 2 * flipSign) | ||
.lineTo(width, height / 2 - height / 2 * flipSign) | ||
.moveTo(width / 2, height - height / 2 * flipSign) | ||
.lineTo(width, height - height / 2 * flipSign); | ||
} | ||
graphics.pivot.x = width / 2; | ||
@@ -19,0 +39,0 @@ graphics.pivot.y = height / 2; |
@@ -13,15 +13,12 @@ import { PI, DOOR_THICKNESS, LINE_WIDTH, ALPHA } from '../constant.js'; | ||
graphics | ||
.lineStyle(lineWidth, color.arcLine) | ||
.beginFill(color.fill, ALPHA) | ||
.arc(width * flipSign, height / 2, width, - PI / 2 * flipSign - PI / 2, -PI * flipSign / 2) | ||
.moveTo(width - width * flipSign, height / 2) | ||
.lineTo(width - width * flipSign, height) | ||
.lineTo(width * flipSign, height) | ||
.lineTo(width * flipSign, height / 2 - width) | ||
.endFill() | ||
.beginFill(color.fill) | ||
.lineStyle(lineWidth, color.middleLine) | ||
.arc(width * flipSign, height / 2, width, -PI / 2 * flipSign - PI / 2, -PI * flipSign / 2) | ||
.lineStyle(lineWidth, color.middleLine) | ||
.lineTo(width * flipSign, height / 2) | ||
.lineTo(0, height / 2 - width + flipSign * width) | ||
.beginFill(color.fill, ALPHA) | ||
.drawRect((width - doorThickness) * flipSign, height / 2 - width, doorThickness, width) | ||
.endFill(); | ||
graphics.pivot.x = width / 2; | ||
@@ -28,0 +25,0 @@ graphics.pivot.y = height / 2; |
import { getColors } from '../utils.js'; | ||
import { STATE } from '../constant.js'; | ||
@@ -12,7 +13,26 @@ export const SlidingDoor = (graphics, context) => { | ||
.drawRect(0, 0, width, height) | ||
.endFill() | ||
.beginFill(color.fill) | ||
.drawRect(0 , height / 2 * flipSign, width / 2 + centerWidth, height / 2) | ||
.drawRect(width / 2 - centerWidth, height / 2 - height / 2 * flipSign, width / 2 + centerWidth, height / 2); | ||
.endFill(); | ||
if (STATE.mode === 'face') { | ||
graphics | ||
.beginFill(color.middleLine) | ||
.drawRect(0 , height / 2 * flipSign, width / 2 + centerWidth, height / 2) | ||
.drawRect(width / 2 - centerWidth, height / 2 - height / 2 * flipSign, width / 2 + centerWidth, height / 2); | ||
} | ||
if (STATE.mode === 'line') { | ||
graphics | ||
.lineStyle(2, color.middleLine) | ||
.moveTo(0, height / 2 * flipSign) | ||
.lineTo(width / 2, height / 2 * flipSign) | ||
.moveTo(0, height / 2 + height / 2 * flipSign) | ||
.lineTo(width / 2, height / 2 + height / 2 * flipSign) | ||
.moveTo(width / 2, 0) | ||
.lineTo(width / 2, height) | ||
.moveTo(width / 2, height / 2 - height / 2 * flipSign) | ||
.lineTo(width, height / 2 - height / 2 * flipSign) | ||
.moveTo(width / 2, height - height / 2 * flipSign) | ||
.lineTo(width, height - height / 2 * flipSign); | ||
} | ||
graphics.pivot.x = width / 2; | ||
@@ -19,0 +39,0 @@ graphics.pivot.y = height / 2; |
@@ -13,7 +13,9 @@ import { LINE_WIDTH } from '../constant.js'; | ||
.beginFill(color.fill) | ||
.drawRect(0, 0, width, height) | ||
.moveTo(0, height / 3) | ||
.lineTo(width, height / 3) | ||
.moveTo(0, height * 2 / 3) | ||
.lineTo(width, height * 2 / 3) | ||
.moveTo(0, 0) | ||
.lineTo(width, 0) | ||
.moveTo(0, height) | ||
.lineTo(width, height) | ||
.lineStyle(lineWidth * 2, color.middleLine) | ||
.moveTo(0, height / 2) | ||
.lineTo(width, height / 2) | ||
.endFill(); | ||
@@ -20,0 +22,0 @@ |
@@ -13,11 +13,12 @@ import { LINE_WIDTH } from '../constant.js'; | ||
.beginFill(color.fill) | ||
.drawRect(0, 0, width, height) | ||
.endFill() | ||
.moveTo(0, height / 4) | ||
.lineTo(width, height / 4) | ||
.moveTo(0, 3 * height / 4) | ||
.lineTo(width, 3 * height / 4) | ||
.lineStyle(lineWidth * 2, color.line) | ||
.moveTo(width / 2, height / 4) | ||
.lineTo(width / 2, 3 * height / 4); | ||
.moveTo(0, 0) | ||
.lineTo(width, 0) | ||
.moveTo(0, height) | ||
.lineTo(width, height) | ||
.lineStyle(lineWidth * 2, color.middleLine) | ||
.moveTo(0, height / 2) | ||
.lineTo(width, height / 2) | ||
.moveTo(width / 2, 0) | ||
.lineTo(width / 2, height) | ||
.endFill(); | ||
@@ -24,0 +25,0 @@ graphics.pivot.x = width / 2; |
@@ -13,7 +13,9 @@ import { LINE_WIDTH } from '../constant.js'; | ||
.beginFill(color.fill) | ||
.drawRect(0, 0, width, height) | ||
.moveTo(0, height / 3) | ||
.lineTo(width, height / 3) | ||
.moveTo(0, height * 2 / 3) | ||
.lineTo(width, height * 2 / 3) | ||
.moveTo(0, 0) | ||
.lineTo(width, 0) | ||
.moveTo(0, height) | ||
.lineTo(width, height) | ||
.lineStyle(lineWidth * 2, color.middleLine) | ||
.moveTo(0, height / 2) | ||
.lineTo(width, height / 2) | ||
.endFill(); | ||
@@ -20,0 +22,0 @@ |
@@ -58,12 +58,24 @@ import { LINE_WIDTH } from '../constant.js'; | ||
const smallCross = cross.map(c => c / 3); | ||
const smallOutline = getOutline(main, smallCross); | ||
graphics.lineStyle(lineWidth, color.line); | ||
graphics | ||
.lineStyle(lineWidth, color.line) | ||
.beginFill(color.fill) | ||
.drawPolygon(outline.flat()) | ||
.drawPolygon(smallOutline.flat()) | ||
.endFill(); | ||
graphics.moveTo(...outline[0]); | ||
for (let i = 1; i < outline.length / 2; i++) { | ||
graphics.lineTo(...outline[i]); | ||
} | ||
graphics.moveTo(...outline[outline.length / 2]); | ||
for (let i = outline.length / 2; i < outline.length; i++) { | ||
graphics.lineTo(...outline[i]); | ||
} | ||
graphics.lineStyle(lineWidth * 2, color.middleLine); | ||
graphics.moveTo(...main[0]); | ||
for (let i = 1; i < main.length; i++) { | ||
graphics.lineTo(...main[i]); | ||
} | ||
graphics.pivot.x = 0; | ||
@@ -70,0 +82,0 @@ graphics.pivot.y = 0; |
@@ -41,12 +41,24 @@ import { LINE_WIDTH } from '../constant.js'; | ||
const smallCross = cross.map(c => c / 3); | ||
const smallOutline = getOutline(main, smallCross); | ||
graphics.lineStyle(lineWidth, color.line); | ||
graphics | ||
.lineStyle(lineWidth, color.line) | ||
.beginFill(color.fill) | ||
.drawPolygon(outline.flat()) | ||
.drawPolygon(smallOutline.flat()) | ||
.endFill(); | ||
graphics.moveTo(...outline[0]); | ||
for (let i = 1; i < outline.length / 2; i++) { | ||
graphics.lineTo(...outline[i]); | ||
} | ||
graphics.moveTo(...outline[outline.length / 2]); | ||
for (let i = outline.length / 2; i < outline.length; i++) { | ||
graphics.lineTo(...outline[i]); | ||
} | ||
graphics.lineStyle(lineWidth * 2, color.middleLine); | ||
graphics.moveTo(...main[0]); | ||
for (let i = 1; i < main.length; i++) { | ||
graphics.lineTo(...main[i]); | ||
} | ||
graphics.pivot.x = 0; | ||
@@ -53,0 +65,0 @@ graphics.pivot.y = 0; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26026
627