Add parallax

This commit is contained in:
Schmelczer András 2019-12-23 14:39:49 +01:00
parent c8679b77bf
commit c2dbf995cc
18 changed files with 102 additions and 56 deletions

View file

@ -0,0 +1,23 @@
import { html } from "../../model/misc";
import "./background.scss";
import { fixedSeedRandom } from "../../framework/helper";
export const generate = (
count: number,
probability: number,
width: number,
color: string
): html => `
<section class="background">
${new Array(count)
.fill(0, 0, count)
.map(_ =>
fixedSeedRandom() < probability
? `<div style="width: ${width}px; height: ${width *
(fixedSeedRandom() + 0.1) *
10}px; background-color: ${color}"></div>`
: `<div class="gap"></div>`
)
.join("")}
</section>
`;