【发布时间】:2020-02-01 20:36:57
【问题描述】:
对于一个 VueJS 项目,我有一个带有 HTML5 <video> 标签的视频播放器。在这个视频中,我想在左下角显示一些模糊点。
我使用的是画布,纯 CSS 方法,但这些都不起作用。
在 CSS 中:我在视频前面的 div 上使用了过滤器:blur(20px),但它不起作用,模糊会影响 div 的边框而不是中心。
对于画布,我们尝试相同的方法,但我从来没有得到任何单一的模糊效果
我只需要对图像的红色部分进行模糊效果:
The red part need to be blurred
<template>
<div>
<div class="contenant">
<input type='range' v-model="width" min="0" max="1281" value="0" >
<img id='image' class="img" src="image1.jpg" alt="test">
<div id='filtre' v-bind:style="{ width: width + 'px'}"></div>
</div>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
width: 0,
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.contenant {
width: fit-content;
}
#filtre {
height: 96%;
background-color: red;
position: absolute;
bottom: 0;
opacity: 0.33;
top: 8px;
z-index: 2;
filter: blur(50px);
}
.img{
position:relative;
}
input[type=range] {
width: 81%;
-webkit-appearance: none;
margin: 10px 0;
position: absolute;
z-index: 3;
height: -webkit-fill-available;
background-color: transparent;
}
input[type=range]::-webkit-slider-thumb {
height: 26px;
width: 26px;
border-radius: 17px;
background: #619BFF;
cursor: pointer;
-webkit-appearance: none;
}
【问题讨论】:
-
欢迎来到 Stack Overflow!寻求代码帮助的问题必须包括在问题本身最好在Stack Snippet 中重现它所需的最短代码。见How to create a Minimal, Reproducible Example
标签: javascript css canvas html5-video blur