4
I have this code that creates a wine glass with CSS:
body{
background: #000;
}
.wrap {
width: 100px;
margin: 0 auto;
position: relative;
}
.glass{
margin: 0 auto;
height: 100px;
width: 100px;
border-radius: 0px 0px 50% 50%;
padding-top: 50px;
box-sizing: border-box;
background-color: rgba(0,222,255, 0.3);
}
.liquid{
width: 100px;
bottom: 96px;
left: 0;
position: absolute;
height: 50px;
border-radius: 0px 0px 100px 100px;
display:block;
z-index: -1;
background-color: rgba(255,0,0, 0.5);
}
.stem {
margin: 0 auto;
height: 75px;
width: 10px;
background-color: rgba(0,222,255, 0.3);
border-bottom: 2px solid rgb(0,155.4,178.5) ;
border-radius: 0px 0px 5px 5px;
}
.base {
margin: 0 auto;
margin-top: -6px;
width: 100px;
height: 25px;
border-radius: 50%;
background-color: rgba(0,222,255, 0.3);
}
<div class="wrap">
<div class="glass"></div>
<div class="liquid"></div>
<div class="stem"></div>
<div class="base"></div>
</div>
The part that simulates the liquid in the bowl is div .liquid
who has the height of 50px
.
How I would make this height go from 50px to 100px, in an animated way and take 4 seconds, once the page opens, using CSS only?
I tried to do with the .animate
jQuery’s but keeps crashing because of other functions running at the same time.
Have you tried with
animation
ortransition
(CSS) orrequestAnimationFrame
(JS - suggestion due to the attempt with jQuery)?– Valdeir Psr
I got it from Animation. VLW!
– Sam
Puts an answer with the solution
– Costamilam
@If you have an answer, put it there for us.
– Sam
I don’t, but I was curious how it turned out :)
– Costamilam
@Guilhermecostamilam posted response!
– Sam