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