Created
October 21, 2019 22:03
-
-
Save fabioluzm/8db0b6e72e52b73d0dc5d5ddb7d1cbac to your computer and use it in GitHub Desktop.
Animação Interativa - CSS Transitions
This file contains 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="trigger"> | |
<div class="box"></div> | |
</div> |
This file contains 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
$(".trigger").on("click", function() { | |
$(this).toggleClass("clicked"); | |
}); |
This file contains 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.4.1/jquery.min.js"></script> |
This file contains 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
body { | |
padding: 50px; | |
} | |
.trigger { | |
width: 200px; | |
height: 200px; | |
border: 20px solid #999; | |
background: #ddd; | |
} | |
.box { | |
display: inline-block; | |
background: pink; | |
width: 200px; | |
height: 200px; | |
transition: -webkit-transform 300ms cubic-bezier(0, 0.47, 0.32, 1.97); | |
transition: transform 300ms cubic-bezier(0, 0.47, 0.32, 1.97); | |
transition: transform 300ms cubic-bezier(0, 0.47, 0.32, 1.97), -webkit-transform 300ms cubic-bezier(0, 0.47, 0.32, 1.97); | |
pointer-events: none; | |
} | |
.trigger.clicked .box { | |
-webkit-transform: translate(200px, 150px) rotate(20deg); | |
transform: translate(200px, 150px) rotate(20deg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment