MCPcopy Create free account
hub / github.com/Barrior/JParticles / getShapeData

Function getShapeData

src/common/shape.ts:147–165  ·  view source on GitHub ↗

* 获取形状数据

()

Source from the content-addressed store, hash-verified

145 * 获取形状数据
146 */
147 protected getShapeData(): ShapeData {
148 const { shape } = this.options
149 const defaultShapeData: ShapeData = { type: 'circle' }
150
151 if (!shape) {
152 return defaultShapeData
153 }
154
155 if (isArray(shape)) {
156 const length = (shape as ShapeType[]).length
157 if (length) {
158 const value = (shape as ShapeType[])[Math.floor(Math.random() * length)]
159 return generateShapeData(value)
160 }
161 return defaultShapeData
162 }
163
164 return generateShapeData(shape as ShapeType)
165 }
166
167 /**
168 * 绘制形状

Callers

nothing calls this directly

Calls 2

isArrayFunction · 0.90
generateShapeDataFunction · 0.85

Tested by

no test coverage detected