Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS 动画 #36

Open
xszi opened this issue Mar 18, 2021 · 0 comments
Open

CSS 动画 #36

xszi opened this issue Mar 18, 2021 · 0 comments

Comments

@xszi
Copy link
Owner

xszi commented Mar 18, 2021

基本语法 & 常用属性

/*
duration | time-function | delay | iteration-count | direction | fill-mode | play-state | name
*/
name {
    animation: 3s ease-in 1s 2 reverse both paused someFrames;

    animation-duration: 3s;
    animation-timing-function: ease;
    animation-delay: 1s;
    animation-iteration-count: 2;
    animation-direction: reverse;
    animation-fill-mode: both;
    animation-play-state: paused;
    animation-name: someFrames;

    @keyframes someFrames {
        from{
            /* some css*/
        }
        to{
            /* some css */
        }
    }
}

构成一个动画需要的最基本属性

@keyframes
animation-name
animation-duration 

一个简单动画栗子

<div class="circle"></div>
.circle {
    height: 50px;
    width: 50px;
    background-color: blue;
    border-radius: 50%;

    animation-name: leftToRight;
    animation-duration: 3s;
}

@keyframes leftToRight {
    from {
        margin-left: 0px;
    }
    to {
        margin-left: 500px
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant