Skip to content

Commit b491ca0

Browse files
committed
(v0.4.5-alpha) Btn Anim + Glitch Effect
Added simple button hover animations on the hero, added a glitch effect when hovering over the CIPHER header!
1 parent a5f8b5d commit b491ca0

3 files changed

Lines changed: 115 additions & 26 deletions

File tree

src/routes/landing.jsx

Lines changed: 81 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,71 @@
11
import "../styles/routes/landing.css";
22
import {ArrowDown, ArrowUpRight} from "lucide-react";
3-
// import {useState} from "react";
3+
import {useState} from "react";
44

55

66
function Landing() {
77

88
const generateBinary = (length = 256) => {
9-
return Array.from({ length }, (_, i) => i % 2 ? 1 : 0).join("");
9+
return Array.from({length}, (_, i) => i % 2 ? 1 : 0).join("");
1010
}
1111

12+
const number = "105,406";
13+
14+
const DEFAULT_TITLE = "C1PHΣR"
15+
const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
16+
const [title, setTitle] = useState("C1PHΣR");
17+
18+
const glitchEffect = () => {
19+
let iterations = 0;
20+
21+
const interval = setInterval(() => {
22+
setTitle(
23+
title.split("")
24+
.map((letter, index) => {
25+
if (index < iterations) {
26+
return DEFAULT_TITLE[index];
27+
}
28+
29+
return letters[Math.floor(Math.random() * 26)]
30+
})
31+
.join("")
32+
);
33+
34+
if (iterations >= DEFAULT_TITLE.length) clearInterval(interval);
35+
36+
iterations += 1/3;
37+
}, 30);
38+
39+
};
40+
1241
return (
1342
<>
14-
<section className={"landing"}>
43+
<section id={"landing"} className={"landing"}>
1544
<section className={"hero"}>
16-
<h1 className={"header-font"}>
17-
C1PH
18-
<span className={"sigma-font"}>Σ</span>
19-
R
45+
<h1
46+
className={"header-font"}
47+
onMouseEnter={glitchEffect}
48+
>
49+
{title.split("").map((char, i) =>
50+
char === "Σ"
51+
? <span key={i} className="sigma-font">Σ</span>
52+
: char
53+
)}
2054
</h1>
2155
<p>Build a <span className={"success"}>CYBERSECURITY</span> related project.</p>
2256
<p>Get <i><a href={"#"}>laptops</a></i>, <i><a href={"#"}>hacker kits</a></i>, and more!</p>
2357

2458
<div className={"buttons"}>
25-
<div className={"button-container"}>
26-
Learn More <ArrowDown size={16} strokeWidth={2} />
27-
</div>
28-
<div className={"button-container-important"}>
29-
RSVP <ArrowUpRight size={16} strokeWidth={3}/>
30-
</div>
59+
<a href={"#ysws"}>
60+
<div className={"button-container"}>
61+
Learn More <ArrowDown size={16} strokeWidth={2}/>
62+
</div>
63+
</a>
64+
<a href={"#footer"}>
65+
<div className={"button-container-important"}>
66+
RSVP <ArrowUpRight size={16} strokeWidth={3}/>
67+
</div>
68+
</a>
3169
</div>
3270

3371
<div className={"terminal"}>
@@ -42,12 +80,17 @@ function Landing() {
4280
</div>
4381
</div>
4482
<div className={"body"}>
45-
<p>anon@hackclub ~ %</p>
83+
<p>anon@hackclub ~ % ./start --journey</p>
84+
<p>OBJECTIVE: <span className={"accent"}>BUILD. BREAK. SECURE.</span><br/>
85+
REWARD SYSTEM: <span className={"info"}>BYTES ENABLED</span><br/>
86+
STATUS: <span className={"success"}>READY</span>
87+
<span className={"cursor"}><b>_</b></span>
88+
</p>
4689
</div>
4790
</div>
4891
</section>
4992
</section>
50-
<section className="ysws">
93+
<section id={"ysws"} className="ysws">
5194
<div className={"divider"}>
5295
<div className="track">
5396
<span>{generateBinary()}</span>
@@ -110,7 +153,7 @@ function Landing() {
110153
</div>
111154

112155
</section>
113-
<section className={"community"}>
156+
<section id={"community"} className={"community"}>
114157
<div className={"divider"}>
115158
<div className="track">
116159
<span>{generateBinary()}</span>
@@ -125,7 +168,8 @@ function Landing() {
125168
<div className={"container"}>
126169
<div className={"description"}>
127170
<h2>Join the community</h2>
128-
<p>Connect with thousands of teen hackers on Slack, share your projects, and get help when you're stuck.</p>
171+
<p>Connect with thousands of teen hackers on Slack, share your projects, and get help when
172+
you're stuck.</p>
129173
<div className={"buttons"}>
130174
{/*<div className={"button-container"}>*/}
131175
{/* Learn More*/}
@@ -154,13 +198,17 @@ function Landing() {
154198
INIT handshake...<br/>
155199
RESOLVING: <span className="accent">hackclub.com/slack</span><br/>
156200
STATUS: <span className="success">FRIENDLY</span><br/>
157-
NODES: <span className="info">49,567</span><br/>
201+
NODES: <span className="info">
202+
<span className="info">
203+
{number ? number.toLocaleString() : "..." }
204+
</span>
205+
</span><br/>
158206
</p>
159207
</div>
160208
</div>
161209
</div>
162210
</section>
163-
<section className={"faqs"}>
211+
<section id={"faqs"} className={"faqs"}>
164212
<div className={"divider"}>
165213
<div className="track">
166214
<span>{generateBinary()}</span>
@@ -171,13 +219,15 @@ function Landing() {
171219

172220
<h1>FAQs</h1>
173221
<div className={"small-divider"}/>
174-
<p>Some of your pressing questions about <i>CIPHER</i><br/>
222+
<p>Some of your pressing questions about <i>CIPHER</i><br/>
175223
has been answered below: </p>
176224

177225
<div className={"container"}>
178226
<div className={"faq"}>
179227
<div className={"question"}>Q. When will this start?</div>
180-
<div className={"answer"}><i>CIPHER</i> is a YSWS concept. If this gets selected for 2026 Summer Internship or if I get sponsors this will become a reality! Keep an eye on #cipher!</div>
228+
<div className={"answer"}><i>CIPHER</i> is a YSWS concept. If this gets selected for 2026 Summer
229+
Internship or if I get sponsors this will become a reality! Keep an eye on #cipher!
230+
</div>
181231
</div>
182232
<div className={"faq"}>
183233
<div className={"question"}>Q. Can I submit multiple projects?</div>
@@ -186,20 +236,24 @@ function Landing() {
186236
<div className={"faq"}>
187237
<div className={"question"}>Q. What is <i>"BYTES"</i>?</div>
188238
<div className={"answer"}>
189-
<i>BYTES</i> are the fake currency of Cipher. After submitting a project, it will go through voting. The result of the voting determines how many <i>BYTES</i> you'll receive for each hour coded.<br/><br/>
190-
Use the <i>BYTES</i> to buy something nice!</div>
239+
<i>BYTES</i> are the fake currency of Cipher. After submitting a project, it will go through
240+
voting. The result of the voting determines how many <i>BYTES</i> you'll receive for each
241+
hour coded.<br/><br/>
242+
Use the <i>BYTES</i> to buy something nice!
243+
</div>
191244
</div>
192245
<div className={"faq"}>
193246
<div className={"question"}>Q. How do I track time?</div>
194247
<div className={"answer"}>
195248
Use Hackatime, an editor extension that tracks the time you spend coding. You can install it
196-
<a href={"https://hackatime.hackclub.com/"} target="_blank" rel="noopener noreferrer"> here</a>
249+
<a href={"https://hackatime.hackclub.com/"} target="_blank"
250+
rel="noopener noreferrer"> here</a>
197251
!
198252
</div>
199253
</div>
200254
</div>
201255
</section>
202-
<section className={"footer"}>
256+
<section id={"footer"} className={"footer"}>
203257
<div className={"divider"}>
204258
<div className="track">
205259
<span>{generateBinary()}</span>
@@ -210,7 +264,8 @@ function Landing() {
210264
<div className={"container"}>
211265
<div className={"rsvp"}>
212266
<h1>Want it to happen?</h1>
213-
<p>CIPHER is nowhere near completion. So, if you want CIPHER to become a reality, RSVP now! and keep an eye on #cipher!</p>
267+
<p>CIPHER is nowhere near completion. So, if you want CIPHER to become a reality, RSVP now! and
268+
keep an eye on #cipher!</p>
214269
<div className={"buttons"}>
215270
<div className={"button-container"}>
216271
Join Slack

src/styles/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
html {
3+
scroll-behavior: smooth;
4+
}
5+
26
* {
37
font-family: "JetBrains Mono", monospace;
48
/*outline: 1px solid red !important;*/

src/styles/routes/landing.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
letter-spacing: 0.25rem;
3333

3434
font-size: 4rem;
35+
height: 6rem;
3536
font-weight: 800;
3637
margin: 0 0 1rem 0;
3738
}
@@ -52,9 +53,11 @@
5253
flex-direction: row;
5354

5455
gap: 1rem;
56+
user-select: none;
5557
}
5658

5759
.landing .hero .buttons .button-container {
60+
/*cursor: default;*/
5861
display: flex;
5962
align-items: center;
6063
gap: 0.5rem;
@@ -71,9 +74,15 @@
7174
font-weight: 200;
7275

7376
background-color: var(--clr-dark-a0);
77+
78+
transition: 0.2s all;
79+
}
80+
.landing .hero .buttons .button-container:hover {
81+
translate: 0 -0.4rem;
7482
}
7583

7684
.landing .hero .buttons .button-container-important {
85+
/*cursor: default;*/
7786
display: flex;
7887
align-items: center;
7988
gap: 0.5rem;
@@ -85,6 +94,12 @@
8594

8695
border-radius: 0.5rem;
8796
font-weight: 400;
97+
98+
transition: 0.2s ease-in-out all;
99+
}
100+
.landing .hero .buttons .button-container-important:hover {
101+
translate: 0 -0.4rem;
102+
/*background-color: var(--clr-primary-a10);*/
88103
}
89104

90105
.landing .hero .terminal {
@@ -168,6 +183,9 @@
168183

169184
.landing .hero .terminal .body {
170185
display: flex;
186+
flex-direction: column;
187+
188+
align-items: flex-start;
171189

172190
width: 100%;
173191
flex-grow: 1;
@@ -178,6 +196,7 @@
178196

179197
.landing .hero .terminal .body p {
180198
margin-left: 1.5rem;
199+
text-align: left;
181200
}
182201

183202

@@ -732,4 +751,15 @@ a {
732751

733752
border-radius: 1rem;
734753
border: 2px dashed var(--clr-surface-a20);
754+
}
755+
756+
757+
758+
.landing .cursor {
759+
animation: blink 1.5s infinite;
760+
}
761+
762+
@keyframes blink {
763+
0%,50%,100% { opacity: 1; }
764+
25%,75% { opacity: 0; }
735765
}

0 commit comments

Comments
 (0)