move() {
let layerOffset = this.layerOffset,
currentLayerOffset = this.currentLayerOffset,
layerMoveBraking = this.processedConfig.layerMoveBraking,
border = this.border,
points = this.points;
this.currentLayerOffset = {
'1': {
x: layerOffset[1].x + (currentLayerOffset[1].x - layerOffset[1].x) * layerMoveBraking,
y: layerOffset[1].y + (currentLayerOffset[1].y - layerOffset[1].y) * layerMoveBraking
},
'2': {
x: layerOffset[2].x + (currentLayerOffset[2].x - layerOffset[2].x) * layerMoveBraking,
y: layerOffset[2].y + (currentLayerOffset[2].y - layerOffset[2].y) * layerMoveBraking
},
'3': {
x: layerOffset[3].x + (currentLayerOffset[3].x - layerOffset[3].x) * layerMoveBraking,
y: layerOffset[3].y + (currentLayerOffset[3].y - layerOffset[3].y) * layerMoveBraking
}
};
points.forEach(function (point) {
point.coordinatesOnLayer.x += point.speed.x;
point.coordinatesOnLayer.y += point.speed.y;
point.coordinates.x = point.coordinatesOnLayer.x + currentLayerOffset[point.layer].x;
point.coordinates.y = point.coordinatesOnLayer.y + currentLayerOffset[point.layer].y;
if (point.coordinatesOnLayer.x < border.left) {
point.speed.x = Math.abs(point.speed.x)
} else if (point.coordinatesOnLayer.x > border.right) {
point.speed.x = -Math.abs(point.speed.x)
}
if (point.coordinatesOnLayer.y < border.top) {
point.speed.y = Math.abs(point.speed.y)
} else if (point.coordinatesOnLayer.y > border.bottom) {
point.speed.y = -Math.abs(point.speed.y)
}
}, this)
}