Pulsing Heart CSS animation

前端 未结 7 1079
小蘑菇
小蘑菇 2020-12-12 12:34

I`m working on an animated heart only with CSS.

I want it to pulse 2 times, take a small break, and then repeat it again.

What I have now:

sm         


        
7条回答
  •  借酒劲吻你
    2020-12-12 12:55

    I needed this for a project I was working on. I was trying to make it look as realistic as possible, and this is what I came up with.

    @keyframes heartbeat {
        0% {
            transform: scale( .95 );
        }
    
        20% {
            transform: scale( .97 );
        }
    
        30% {
            transform: scale( .95 );
        }
    
        40% {
            transform: scale( 1 );
        }
    
        100% {
            transform: scale( .95 );
        }
    }
    

    animation: heartbeat 1s infinite;

提交回复
热议问题