Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(index): add more 80s #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions src/components/GridRider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import * as React from 'react';
import styled, { keyframes } from '../styled-components';

const cellSize = 128
const numLines = 8
const lineWeight = 2
const gridStops = `
magenta 0,
magenta ${(lineWeight/2)}px,
transparent ${(lineWeight/2)}px,
transparent ${(cellSize/2) - (lineWeight/2)}px,
magenta ${(cellSize/2) - (lineWeight/2)}px,
magenta ${(cellSize/2)}px
`
const GridContainer = styled.div`
display: block;
position: absolute;
z-index: -100;
opacity:.5;
height: ${cellSize*numLines}px;
width: 100%;
overflow: hidden;
bottom: 0;

`
const GridBottom = styled.div`
position: absolute;
transform: scale(3,1) perspective(100vh) rotateX(75deg) ;
perspective-origin: 100%;
transform-origin: bottom center;
left: 0;
right: 0;
top:0;
bottom: 0;
box-shadow: 0 ${cellSize/-4}px ${cellSize}px magenta;
border-top: 2px solid magenta;

::before,
::after {
content: '';
position: absolute;
display: block;
left: 0;
right: 0;
top: 0;
bottom: 0;
}

::before {
content: '';
left:0;
right: 50vw;
background: repeating-linear-gradient(
to left,
${gridStops}
);
}
::after {
content: '';
left: 50vw;
right: 0;
background: repeating-linear-gradient(
to right,
${gridStops}
);
}
`

const gridMove = keyframes`
from {
transform: translateY(0);
}
to {
transform: translateY(${cellSize}px);
}
}`

const GridRule = styled.hr`
width: 100%;
will-change: transform;
animation: .6s ${gridMove} linear infinite;
display: block;
border: ${(lineWeight*2)}px solid magenta;
margin-bottom: ${cellSize - lineWeight*4}px;
`

const GridRider = () => {
const lineArray = Array(8).fill(0);
return <GridContainer>
<GridBottom>
{
lineArray.map((item, index) => (
<GridRule key={index} />
))
}
</GridBottom>
</GridContainer>
}

export default GridRider
4 changes: 3 additions & 1 deletion src/pages/Index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import styled from '../styled-components'
import GridRider from '../components/GridRider'
import Page from '../components/styled-components/Page'
import Title, { OldSchoolTitle } from '../components/styled-components/Title'
import ImageUploader from "../components/ImageUploader";
Expand Down Expand Up @@ -35,8 +36,9 @@ const Index = () => (
<p>⚡️ by <a href="https://github.com/sjoerdbeentjes">@sjoerdbeentjes</a>, <a href="https://www.voorhoede.nl">De Voorhoede</a></p>
<p>See project on <a href="https://github.com/voorhoede/componentizer">Github</a></p>
</Credits>
<GridRider />
</IndexStyles>
</Page>
)

export default Index
export default Index