Skip to content

Commit ef564ac

Browse files
committed
Add animations and styles for crumple effect in CSS
Introduce new keyframe animations for circle and rectangle reveals, enhancing the crumple effect. Update hover styles for footer links to incorporate these animations, improving visual feedback and interactivity.
1 parent 93e5dce commit ef564ac

File tree

1 file changed

+147
-2
lines changed

1 file changed

+147
-2
lines changed

css/crumple.css

Lines changed: 147 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,106 @@
347347
background-color: #222;
348348
}
349349

350+
.crumple:before {
351+
content: "";
352+
position: absolute;
353+
top: 0;
354+
left: 0;
355+
display: block;
356+
width: 100%;
357+
height: 100%;
358+
background-color: transparent;
359+
z-index: 1;
360+
}
361+
362+
@-webkit-keyframes sweep-reveal {
363+
0% {
364+
-webkit-clip-path: circle(60% at -20% 50%);
365+
clip-path: circle(60% at -20% 50%);
366+
}
367+
100% {
368+
-webkit-clip-path: circle(60% at 120% 50%);
369+
clip-path: circle(60% at 120% 50%);
370+
}
371+
}
372+
373+
@keyframes sweep-reveal {
374+
0% {
375+
-webkit-clip-path: circle(60% at -20% 50%);
376+
clip-path: circle(60% at -20% 50%);
377+
}
378+
100% {
379+
-webkit-clip-path: circle(60% at 120% 50%);
380+
clip-path: circle(60% at 120% 50%);
381+
}
382+
}
383+
384+
@-webkit-keyframes dual-circle {
385+
0% {
386+
-webkit-clip-path: circle(25% at -25% 50%) circle(25% at -25% 50%);
387+
clip-path: circle(25% at -25% 50%) circle(25% at -25% 50%);
388+
}
389+
100% {
390+
-webkit-clip-path: circle(25% at 125% 50%) circle(25% at 125% 50%);
391+
clip-path: circle(25% at 125% 50%) circle(25% at 125% 50%);
392+
}
393+
}
394+
395+
@keyframes dual-circle {
396+
0% {
397+
-webkit-clip-path: circle(25% at -25% 50%) circle(25% at -25% 50%);
398+
clip-path: circle(25% at -25% 50%) circle(25% at -25% 50%);
399+
}
400+
100% {
401+
-webkit-clip-path: circle(25% at 125% 50%) circle(25% at 125% 50%);
402+
clip-path: circle(25% at 125% 50%) circle(25% at 125% 50%);
403+
}
404+
}
405+
406+
@-webkit-keyframes circle-one {
407+
0% {
408+
-webkit-clip-path: circle(25vh at -25vh 25%);
409+
clip-path: circle(25vh at -25vh 25%);
410+
}
411+
100% {
412+
-webkit-clip-path: circle(25vh at calc(100vw + 25vh) 25%);
413+
clip-path: circle(25vh at calc(100vw + 25vh) 25%);
414+
}
415+
}
416+
417+
@keyframes circle-one {
418+
0% {
419+
-webkit-clip-path: circle(25vh at -25vh 25%);
420+
clip-path: circle(25vh at -25vh 25%);
421+
}
422+
100% {
423+
-webkit-clip-path: circle(25vh at calc(100vw + 25vh) 25%);
424+
clip-path: circle(25vh at calc(100vw + 25vh) 25%);
425+
}
426+
}
427+
428+
@-webkit-keyframes circle-two {
429+
0% {
430+
-webkit-clip-path: circle(25vh at -25vh 75%);
431+
clip-path: circle(25vh at -25vh 75%);
432+
}
433+
100% {
434+
-webkit-clip-path: circle(25vh at calc(100vw + 25vh) 75%);
435+
clip-path: circle(25vh at calc(100vw + 25vh) 75%);
436+
}
437+
}
438+
439+
@keyframes circle-two {
440+
0% {
441+
-webkit-clip-path: circle(25vh at -25vh 75%);
442+
clip-path: circle(25vh at -25vh 75%);
443+
}
444+
100% {
445+
-webkit-clip-path: circle(25vh at calc(100vw + 25vh) 75%);
446+
clip-path: circle(25vh at calc(100vw + 25vh) 75%);
447+
}
448+
}
449+
350450
@media (hover: hover) {
351451
.footer > a:nth-child(odd):hover~.crumple {
352452
background: #1E90FF; /* fallback for old browsers */
@@ -371,9 +471,23 @@
371471
animation: gradient 30s ease infinite;
372472
}
373473

474+
.footer__link--writings:hover~.crumple .crumple__rect {
475+
-webkit-animation: rectangle-reveal 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
476+
animation: rectangle-reveal 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
477+
}
478+
374479
.footer__link--writings:hover~.crumple:after {
375-
-webkit-animation: a 1s .25s linear forwards;
376-
animation: a 1s .25s linear forwards
480+
-webkit-animation: circle-one 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
481+
animation: circle-one 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
482+
background-color: #222;
483+
z-index: 2;
484+
}
485+
486+
.footer__link--writings:hover~.crumple:before {
487+
-webkit-animation: circle-two 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
488+
animation: circle-two 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
489+
background-color: #ff6347;
490+
z-index: 2;
377491
}
378492
.footer__link--github:hover~.crumple:after {
379493
-webkit-animation: b 1s .25s linear forwards;
@@ -396,3 +510,34 @@
396510
animation: f 1s .25s linear forwards
397511
}
398512
}
513+
514+
@-webkit-keyframes rectangle-reveal {
515+
0% {
516+
-webkit-clip-path: polygon(0 0, 0 100%, 0 100%, 0 0);
517+
clip-path: polygon(0 0, 0 100%, 0 100%, 0 0);
518+
}
519+
100% {
520+
-webkit-clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0);
521+
clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0);
522+
}
523+
}
524+
525+
@keyframes rectangle-reveal {
526+
0% {
527+
transform: translateX(0);
528+
}
529+
100% {
530+
transform: translateX(100%);
531+
}
532+
}
533+
534+
.crumple__rect {
535+
content: "";
536+
position: absolute;
537+
left: calc(-25vh);
538+
display: block;
539+
width: calc(100vw + 50vh);
540+
height: 100%;
541+
background-color: #19e6a1;
542+
z-index: 0;
543+
}

0 commit comments

Comments
 (0)