javascript - 如何使用 CSS3 或 JavaScript 获得填充效果
问题描述
我有这张图片:
在这张图片中,您可以看到 7 滤镜效果。我可以使用 CSS3 过滤器属性生成灰度、棕褐色和反转。
现在,如何使用 CSS3 或 JavaScript获得Duotone、Warm、Cool 和 Dramatic的滤镜效果?
解决方案
Duotone,温暖和凉爽的一些想法。我不确定你所说的戏剧性是什么意思,你能解释一下吗?
这里有一些双色调的资源:
https://jmperezperez.com/duotone-using-css-blend-modes/
div {
display: inline-flex;
position: relative;
}
.duotone {
background: yellow;
}
.duotone:before {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 1;
background: blue;
mix-blend-mode: lighten;
}
.duotone img {
filter: grayscale(100%) contrast(1);
mix-blend-mode: multiply;
}
.warm:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: orange;
mix-blend-mode: overlay;
opacity: .5;
}
.cold:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: blue;
mix-blend-mode: overlay;
opacity: .5;
}
body {
display: inline-grid;
grid-template-columns: auto 1fr;
grid-gap: 2rem;
}
h3 {
margin: 0;
}
<h3>Original</h3>
<div><img src="https://source.unsplash.com/random/200x200"></div>
<h3>Duotone</h3>
<div class="duotone"><img src="https://source.unsplash.com/random/200x200"></div>
<h3>Warm</h3>
<div class="warm"><img src="https://source.unsplash.com/random/200x200"></div>
<h3>Cold</h3>
<div class="cold"><img src="https://source.unsplash.com/random/200x200"></div>
推荐阅读
- docker-for-windows - 从何处获取 Windows 容器基础映像以在 Windows 10 Enterprise(64 位)上的 Docker 或 VirtualBox 中运行
- python - how to combine a list when writing into a txt file?
- c# - 清除 Xamarin Forms 中的选择
- javascript - How to get array based on same key value in javascript
- python - 如何覆盖/自定义 Django 和 Django 休息框架中的所有服务器错误
- kubernetes - Designing K8 pod and proceses for initialization
- r - Differentiate lines in geom_dumbbel by colour using levels of a variable
- sql - How to create "statistics" for every table of a schema? (where statistics means 1 returned record per each table)
- amazon-web-services - 如果我们同时具有分区键和辅助键 (GSI),数据如何在 aws dynamoDb 的表中分区
- sql - oracle查询以选择一组记录中最后更新的记录