palmerye / purecss Goto Github PK
View Code? Open in Web Editor NEWCSS Collection by myself | Pure :see_no_evil: Magical :sparkles: Funny :clown_face:
CSS Collection by myself | Pure :see_no_evil: Magical :sparkles: Funny :clown_face:
主要用到的是
background-clip
这个属性,这个效果是自己YY的,其实还是有点缺陷,比如...
<h1>CaptureColor</h1>
h1 {
font-size: 15rem;
line-height: 21rem;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(165, 153, 153, 0), 0 1px 10px rgba(0, 0, 0, .6), 0 6px 1px rgba(0, 0, 0, .1), 0 0 5px rgba(0, 0, 0, .2), 0 1px 3px rgba(0, 0, 0, .3), 0 3px 5px rgba(0, 0, 0, .2), 0 7px 10px rgba(0, 0, 0, .25), 0 15px 10px rgba(0, 0, 0, .2), 0 25px 15px rgba(0, 0, 0, .15);
position: relative;
overflow: hidden;
background-image: -webkit-linear-gradient(135deg, #000, #000 5%, #000 48.5%, rgb(39, 38, 38) 49%, #fff 50%, rgb(39, 38, 38) 51%, #000 51.5%, #000 98%, #000);
-webkit-text-fill-color: transparent; // 文字填充色为透明
-webkit-text-stroke: .2px rgba(247, 240, 240, 0.164);
-webkit-background-clip: text; // 背景被裁剪为文字的前景色(只有chrome支持)
-webkit-background-size: 400% 100%; // 放大背景区域,使光线进入并消失
-webkit-animation: masked-animation 3s infinite ease-out forwards;
@-webkit-keyframes masked-animation {
0% { background-position: 0 0;}
100% { background-position: -100% 0;}
}
}
background-clip
在MDN文档中,介绍到这个属性作用,设置元素的背景(背景图片或颜色)是否延伸到边框下面。
border-box
:背景延伸到边框外沿(但是在边框之下)。padding-box
:边框下面没有背景,即背景延伸到内边距外沿。content-box
:背景裁剪到内容区 (content-box) 外沿。text
:背景被裁剪为文字的前景色(只有chrome支持)。这个创意效果是在uimovement看到的,有时候不得不佩服一些优秀的设计师的创意。仿照设计师的效果图自己琢磨了下,在箭头转化为方块的动画效果上其实还有点欠缺,没有明显的从箭头慢慢形变成方块。
<span>Let's Go!</span>
span {
display: inline-block;
margin: 0 3rem;
padding: 0 1rem;
width: 15rem;
height: 5rem;
font-size: 3rem;
line-height: 5rem;
text-align: center;
color: #fff;
font-weight: bold;
position: relative;
transition: all .3s;
&::after {
content: '→';
position: absolute;
right: -1rem;
transition: all .1s;
}
&::before {
content: ' ';
display: inline-block;
width: 2rem;
height: 0.2rem;
position: absolute;
top: 2.35rem;
right: -1rem;
background: #fff;
z-index: -1;
opacity: 0;
transition: all .2s ease-in;
}
&:hover {
cursor: pointer;
margin: 0;
color: #000;
&::before {
transform: translateX(-2rem) scale(7.5, 25);
transform-origin: 100% 40%;
opacity: 1;
}
&::after {
opacity: 0;
}
}
}
这里主要用两个伪类来实现,hover
后的背景为before
,箭头为after
,before
在hover
前作为一根细线藏在箭头下,hover
的时候,after
箭头透明度过渡降为0,before
这根线可以transform
形变缩放为元素的背景方块。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.