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

Method init

src/particle.ts:113–131  ·  view source on GitHub ↗

* 初始化数据和运行程序

()

Source from the content-addressed store, hash-verified

111 * 初始化数据和运行程序
112 */
113 protected init(): void {
114 this.ownResizeEvent()
115 this.optionsNormalize()
116
117 if (this.options.range > 0) {
118 // 定位点坐标
119 this.positionX = Math.random() * this.canvasWidth
120 this.positionY = Math.random() * this.canvasHeight
121 this.defineLineShape()
122 this.positionEvent()
123 }
124
125 // 初始化鼠标在视差上的坐标
126 this.mouseX = this.mouseY = 0
127 this.parallaxEvent()
128
129 // 创建粒子
130 this.createDots()
131 }
132
133 /**
134 * 标准化配置参数,参考 calcQuantity 方法描述。

Callers

nothing calls this directly

Calls 6

ownResizeEventMethod · 0.95
optionsNormalizeMethod · 0.95
defineLineShapeMethod · 0.95
positionEventMethod · 0.95
parallaxEventMethod · 0.95
createDotsMethod · 0.95

Tested by

no test coverage detected