在 reveal.js 中调暗背景图像
dim the background image in reveal.js
我正在使用 reveal.js:我想显示全屏图像作为背景,一旦我移动到另一张幻灯片,我想模糊或调暗它。
查看 Changing the background-image style in Reveal.js,我在我的 css 中尝试过:
.html.blur .backgrounds {
-webkit-filter: blur(5px);
-moz-filter: blur(10px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
}
然后在我的降价文档中,我用
做了一个 html 评论
.slide: data-background="figs/background.svg" data-background-size="contain" data-state="blur"
创建一个 <section>
标签,里面有 data-state="blur"
。然而,背景并没有变得模糊 -- 我错过了什么?
只是一个错字:没有“.”在 html...
前面
这将起作用,除了模糊之外,还可以进行一些调暗和饱和度更改,这将使前景文本更易于阅读:
html.dim .backgrounds {
-webkit-filter: blur(4px) saturate(.5) brightness(.8);
-moz-filter: blur(4px) saturate(.7) brightness(.9);
-o-filter: blur(4px) saturate(.7) brightness(.9);
-ms-filter: blur(4px) saturate(.7) brightness(.9);
filter: blur(4px) saturate(.7) brightness(.9);
}
如果你想让它看起来更时髦,你可以添加一个动画:
@-webkit-keyframes blur-animation {
0% {
-webkit-filter: blur(0px) ;
-moz-filter: blur(0px);
-o-filter: blur(0px);
-ms-filter: blur(0px);
filter: blur(0px);
}
100% {
-webkit-filter: blur(4px) saturate(.5) brightness(.8);
-moz-filter: blur(5px) saturate(.7) brightness(.9);
-o-filter: blur(5px) saturate(.7) brightness(.9);
-ms-filter: blur(5px)saturate(.7) brightness(.9);
filter: blur(5px) saturate(.7) brightness(.9);
}
}
html.background-blur-animation .backgrounds {
-webkit-animation-name: blur-animation;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: 1;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-out;
-webkit-animation-fill-mode: forwards;
-webkit-animation-delay: 0s;
}
请检查源代码中的这一行
html.blur.backgrounds {
//no (. sign)is required in front of .html or copy the above line and paste it.
我正在使用 reveal.js:我想显示全屏图像作为背景,一旦我移动到另一张幻灯片,我想模糊或调暗它。 查看 Changing the background-image style in Reveal.js,我在我的 css 中尝试过:
.html.blur .backgrounds {
-webkit-filter: blur(5px);
-moz-filter: blur(10px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
}
然后在我的降价文档中,我用
做了一个 html 评论.slide: data-background="figs/background.svg" data-background-size="contain" data-state="blur"
创建一个 <section>
标签,里面有 data-state="blur"
。然而,背景并没有变得模糊 -- 我错过了什么?
只是一个错字:没有“.”在 html...
前面这将起作用,除了模糊之外,还可以进行一些调暗和饱和度更改,这将使前景文本更易于阅读:
html.dim .backgrounds {
-webkit-filter: blur(4px) saturate(.5) brightness(.8);
-moz-filter: blur(4px) saturate(.7) brightness(.9);
-o-filter: blur(4px) saturate(.7) brightness(.9);
-ms-filter: blur(4px) saturate(.7) brightness(.9);
filter: blur(4px) saturate(.7) brightness(.9);
}
如果你想让它看起来更时髦,你可以添加一个动画:
@-webkit-keyframes blur-animation {
0% {
-webkit-filter: blur(0px) ;
-moz-filter: blur(0px);
-o-filter: blur(0px);
-ms-filter: blur(0px);
filter: blur(0px);
}
100% {
-webkit-filter: blur(4px) saturate(.5) brightness(.8);
-moz-filter: blur(5px) saturate(.7) brightness(.9);
-o-filter: blur(5px) saturate(.7) brightness(.9);
-ms-filter: blur(5px)saturate(.7) brightness(.9);
filter: blur(5px) saturate(.7) brightness(.9);
}
}
html.background-blur-animation .backgrounds {
-webkit-animation-name: blur-animation;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: 1;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-out;
-webkit-animation-fill-mode: forwards;
-webkit-animation-delay: 0s;
}
请检查源代码中的这一行
html.blur.backgrounds {
//no (. sign)is required in front of .html or copy the above line and paste it.