html - How to make div bigger as it spins (CSS3 Animation) -
i spin div when hover on , spin want make bigger zoom in.
so far have this:
[html]
div class="mymsg"> <p id="welly" style="color: #009">welcome y3!<br><br><br>thanks stopping by!</p> </div>
[css]
.mymsg { background: white; width: 800px; height : 500px; margin: 100px auto; border: 1px solid black; opactiy: 0.5; -webkit-transform: rotate(360deg); /* safari , chrome */ -webkit-transform: scale(.1,.1) skew(45deg) translatex(-300px); box-shadow: 0px 0px 200px grey; } .mymsg:hover { opacity: 1; -webkit-transform: rotate(360deg); /* safari , chrome */ -webkit-transform: scale(1,.1 skew(0deg); box-shadow: 0px 0px 200px grey; }
so want spin before scaling regular size
any appreciated
now that's out of way, let's down nitty gritty , show how it.
first, you'll want use animation
animate properties , rotation effect. sadly, transition won't enough since transitioning between 0 , 360 means aren't going anywhere. so, animate properties 1 other on hover. code end looking this:
@keyframes spin { { transform: scale(.1,.1) skew(0deg) rotate(0deg); } { transform: scale(1,1) skew(0deg) rotate(360deg); } } .mymsg:hover { animation: spin 1s forwards; }
the @keyframes
defines animation happen, , want transform 1 set of properties final one. then, set :hover
play animation. relevant properties animation animation-name
, animation-duration
, , animation-fill-mode
(which should have same properties last frame when done animating. webkit requires prefixes, you'll want put in too.
in addition this, placed transition: transform 1s;
on .mymsg
class animate after mouse moves away. note webkit doesn't seem play nice interaction between two, bit choppy , less ideal. but, experimental properties this, get.
some side notes:
- your css isn't cross browser compatible, should clean bit
- you're defining 1 transform property, , overriding it. transforms need go in same declaration. can't combined that
Comments
Post a Comment