Skip to content
Snippets Groups Projects
Commit 03e01e3e authored by Dj's avatar Dj
Browse files

fix(parallax-css-testpage): Remove object destructuring to increase compatibility.

parent 7d28b015
No related branches found
No related tags found
No related merge requests found
......@@ -66,9 +66,6 @@ function RandomPoint2D(minMaxX, minMaxY) {
return Point2D( x, y )
}
function Particle({ position, direction, size, color }) {
return { position, direction, size, color }
}
//
......@@ -216,7 +213,12 @@ function Animate(scene, particles) {
}
}
function CreateScene({ canvasId, contentId, depth, fps }) {
function CreateScene(cfg) {
var canvasId = cfg.canvasId,
contentId = cfg.contentId,
depth = cfg.depth,
fps = cfg.fps
var contentNode = document.getElementById(contentId),
height = getNodeHeight(contentNode),
width = window.innerWidth,
......@@ -243,19 +245,19 @@ function CreateScene({ canvasId, contentId, depth, fps }) {
}
function CreateParticles(scene, {
density,
color,
size,
speed,
lifespan,
}) {
function CreateParticles(scene, cfg) {
var density = cfg.density,
color = cfg.color,
size = cfg.size,
speed = cfg.speed,
lifespan = cfg.lifespan
return Array.from(
{
length: calcParticleCount(scene, density)
},
function createParticle() {
return Particle({
function Particle() {
return {
position:
RandomPoint2D(
MinMax(0, (scene.width - (size * 2))),
......@@ -278,7 +280,7 @@ function CreateParticles(scene, {
: +1,
},
color
})
}
}
)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment