Last active
July 30, 2025 02:23
-
-
Save NoelDavies/8f78ccbdd2ec9dd96e6da2bf87db1d9d to your computer and use it in GitHub Desktop.
Animation Open Envelope
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="envelope new"> | |
| <div class="front"> | |
| <div class="mailme"> | |
| <p>Resultado Final</p> | |
| <p>clique para exibir</p> | |
| </div> | |
| </div> | |
| <div class="back"> | |
| <div class="letter"> | |
| </div> | |
| <div class="flap left-flap"></div> | |
| <div class="flap right-flap"></div> | |
| <div class="flap bottom-flap"></div> | |
| <div class="flap top-flap"></div> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function(){ | |
| if (!$('.envelope').hasClass('open')){ | |
| $('.envelope').click(function(){ | |
| $(this).removeClass('new').addClass('open'); | |
| }); | |
| } | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import url(https://fonts.googleapis.com/css?family=Allan:700,400); | |
| @keyframes open { | |
| 0% { | |
| transform: translate3d(0, 0, 0) rotateY(0); | |
| } | |
| 33.333% { | |
| transform: translate3d(-100%, 0, 0) rotateY(-180deg); | |
| } | |
| 66.666% { | |
| transform: translate3d(-100%, 0, 0) rotateY(-180deg); | |
| } | |
| 100% { | |
| transform: translate3d(-100%, 0, 0) rotateY(-180deg); | |
| } | |
| } | |
| body, html { | |
| width: 100%; | |
| height: 100%; | |
| } | |
| body { | |
| margin: 0; | |
| background-color: #2b43ea; | |
| position: relative; | |
| perspective: 800px; | |
| overflow: hidden; | |
| } | |
| .envelope { | |
| z-index: 2; | |
| position: absolute; | |
| width: 550px; | |
| height: 366.66667px; | |
| top: 50%; | |
| left: 50%; | |
| margin-top: -183.33333px; | |
| margin-left: -275px; | |
| transform-style: preserve-3d; | |
| transform-origin: right center; | |
| transition: transform 1s ease; | |
| font-family: "Allan", sans-serif; | |
| color: #1F1F1F; | |
| } | |
| .envelope .front, .envelope .back { | |
| position: absolute; | |
| width: 100%; | |
| height: 100%; | |
| background-color: #FFF; | |
| border-radius: 5px; | |
| box-shadow: inset 0 0 30px -5px #a87e50, 0 0 20px -5px; | |
| } | |
| .envelope .front { | |
| backface-visibility: hidden; | |
| cursor: pointer; | |
| display: table; | |
| } | |
| .envelope .front:focus { | |
| outline: none; | |
| } | |
| .envelope .front .mailme { | |
| text-align: center; | |
| display: table-cell; | |
| vertical-align: middle; | |
| } | |
| .envelope .front .mailme p { | |
| font-weight: bold; | |
| margin: 0; | |
| } | |
| .envelope .front .mailme p:first-child { | |
| font-size: 50px; | |
| line-height: 50px; | |
| } | |
| .envelope .front .mailme p:last-child { | |
| font-size: 30px; | |
| } | |
| .envelope .back { | |
| transform: rotateY(180deg) translate3d(0, 0, 1px); | |
| } | |
| .envelope .back .flap { | |
| position: absolute; | |
| width: 100%; | |
| height: 100%; | |
| overflow: hidden; | |
| } | |
| .envelope .back .flap:before { | |
| content: ""; | |
| position: absolute; | |
| background-color: #FFF; | |
| box-shadow: inset 0 0 30px -7px #a87e50; | |
| } | |
| .envelope .back .top-flap:before, .envelope .back .bottom-flap:before { | |
| width: 388.90873px; | |
| height: 388.90873px; | |
| } | |
| .envelope .back .top-flap { | |
| z-index: 5; | |
| transform-origin: top center; | |
| } | |
| .envelope .back .top-flap:before { | |
| transform-origin: top left; | |
| transform: rotate(-45deg); | |
| border-bottom-left-radius: 50px; | |
| border-top-left-radius: 10px; | |
| border-bottom-right-radius: 10px; | |
| } | |
| .envelope .back .bottom-flap { | |
| z-index: 4; | |
| } | |
| .envelope .back .bottom-flap:before { | |
| transform-origin: left bottom; | |
| transform: rotate(45deg) translate(-15px, -15px); | |
| border-top-left-radius: 100px; | |
| border-bottom-left-radius: 10px; | |
| border-top-right-radius: 10px; | |
| } | |
| .envelope .back .left-flap:before, .envelope .back .right-flap:before { | |
| width: 269.27249px; | |
| height: 269.27249px; | |
| top: -5px; | |
| } | |
| .envelope .back .left-flap { | |
| z-index: 3; | |
| } | |
| .envelope .back .left-flap:before { | |
| transform-origin: top left; | |
| transform: rotate(45deg); | |
| border-top-left-radius: 20px; | |
| border-bottom-right-radius: 30px; | |
| border-top-right-radius: 5px; | |
| } | |
| .envelope .back .right-flap { | |
| z-index: 2; | |
| } | |
| .envelope .back .right-flap:before { | |
| right: 0; | |
| transform-origin: top right; | |
| transform: rotate(-45deg); | |
| border-top-right-radius: 20px; | |
| border-bottom-left-radius: 30px; | |
| border-top-left-radius: 5px; | |
| } | |
| .envelope .back .letter textarea { | |
| resize: none; | |
| height: 117.66667px; | |
| } | |
| .envelope.open { | |
| animation: open 3s forwards; | |
| } | |
| .envelope.open .top-flap { | |
| animation: flap-open 1s 1s forwards; | |
| } | |
| .envelope.open .letter { | |
| animation: letter-out 1s 2s forwards; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment