Add parallax
This commit is contained in:
parent
c8679b77bf
commit
c2dbf995cc
18 changed files with 102 additions and 56 deletions
23
src/page/background/background.html.ts
Normal file
23
src/page/background/background.html.ts
Normal 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>
|
||||
`;
|
||||
Loading…
Add table
Add a link
Reference in a new issue