xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

CSS3 Animation & linear-gradient & css3 var & @keyframes

CSS3 Animation & linear-gradient & css3 var & @keyframes

https://www.zhangxinxu.com/wordpress/2019/05/css-variable-seed-extend-animation/

linear-gradient


.gradient {
    background-image: linear-gradient(45deg, red 50%, blue 50%);
}

@keyframes

dot::before {
    content: '...';
    position: absolute;
    animation: dot 3s infinite step-start both;
}
dot:after {
    content: '...';
    color: transparent;
}
@keyframes dot {
    33% { content: '.'; }
    66% { content: '..'; }
}
<button>正在加载中<dot></dot></button>

css --var & var()

@keyframes var {
    33% { --someVar: 33%; }
    66% { --someVar: 66%; }
}

@keyframes seed {
    0%{--seed:0}
    1%{--seed:1}
    2%{--seed:2}3%{--seed:3}4%{--seed:4}5%{--seed:5}6%{--seed:6}7%{--seed:7}8%{--seed:8}9%{--seed:9}10%{--seed:10}11%{--seed:11}12%{--seed:12}13%{--seed:13}14%{--seed:14}15%{--seed:15}16%{--seed:16}17%{--seed:17}18%{--seed:18}19%{--seed:19}20%{--seed:20}21%{--seed:21}22%{--seed:22}23%{--seed:23}24%{--seed:24}25%{--seed:25}26%{--seed:26}27%{--seed:27}28%{--seed:28}29%{--seed:29}30%{--seed:30}31%{--seed:31}32%{--seed:32}33%{--seed:33}34%{--seed:34}35%{--seed:35}36%{--seed:36}37%{--seed:37}38%{--seed:38}39%{--seed:39}40%{--seed:40}41%{--seed:41}42%{--seed:42}43%{--seed:43}44%{--seed:44}45%{--seed:45}46%{--seed:46}47%{--seed:47}48%{--seed:48}49%{--seed:49}50%{--seed:50}51%{--seed:51}52%{--seed:52}53%{--seed:53}54%{--seed:54}55%{--seed:55}56%{--seed:56}57%{--seed:57}58%{--seed:58}59%{--seed:59}60%{--seed:60}61%{--seed:61}62%{--seed:62}63%{--seed:63}64%{--seed:64}65%{--seed:65}66%{--seed:66}67%{--seed:67}68%{--seed:68}69%{--seed:69}70%{--seed:70}71%{--seed:71}72%{--seed:72}73%{--seed:73}74%{--seed:74}75%{--seed:75}76%{--seed:76}77%{--seed:77}78%{--seed:78}79%{--seed:79}80%{--seed:80}81%{--seed:81}82%{--seed:82}83%{--seed:83}84%{--seed:84}85%{--seed:85}86%{--seed:86}87%{--seed:87}88%{--seed:88}89%{--seed:89}90%{--seed:90}91%{--seed:91}92%{--seed:92}93%{--seed:93}94%{--seed:94}95%{--seed:95}96%{--seed:96}97%{--seed:97}98%{--seed:98}
    99%{--seed:99}
    100%{--seed:100}
}

.gradient {
    width: 150px; height: 150px;
    background-image: linear-gradient(calc(3.6deg * var(--seed)), red 50%, blue 50%);
    animation: seed 1s linear infinite;
}
<div class="gradient"></div>

.radial-gradient {
    padding: 50%;
    background-image: radial-gradient(#cd0000 calc(2% * var(--seed)), transparent calc(2% * var(--seed)));
    background-size: 80px 80px;
    animation: seed 1s linear infinite;    
}

<div class="radial-gradient"></div>




mask demo

https://codepen.io/forx-js/pen/LojozK


posted @ 2019-05-22 22:20  xgqfrms  阅读(434)  评论(0编辑  收藏  举报