更多>
最新下载
西山居首页jQuery焦点图代码
西山居首页jQuery焦点图代码是一款带文字描述,左右箭头,索引按钮,自动轮播切换的jQuery特效代码。本作品由【站长素材】收集整理,转载请注明出处!
0
2026-01-25
24小时阅读排行榜
- 1 FIMO输出HTML会带3D变换参数吗_FIMO输出HTML3D变换说明【解析】
- 2 pydantic 如何自定义 RootModel 处理整个 JSON 结构的校验
- 3 如何让 tqdm 在多线程环境中安全更新同一进度条
- 4 如何判断一个文件描述符是否已关闭(不抛异常)
- 5 html5滤镜怎样加雪花飘落_html5雪花滤镜应用教程【步骤】
- 6 Python 怎么写一个支持链式调用的类方法
- 7 html5布局代码header固定顶部_html5布局代码header固定法【步骤】
- 8 html5滤镜怎样做高光提亮_html5高光滤镜调整方法【步骤】
- 9 html5播放rtsp能叠加logo吗_html5rtsp叠加logo实现【美化】
- 10 pandas 如何把多级索引扁平化为普通列(最简写法)
- 11 html5play函数调用会阻塞线程吗_html5play函数线程影响法【步骤】
- 12 datetime 如何正确处理夏令时切换时的 ambiguous 时间
- 13 html个人页面怎么插入音频_html音频标签使用教程【多媒体】
- 14 html5如何嵌入flv视频_html5嵌入flv兼容播放法【教程】
- 15 html5布局代码多列文本流布局_html5布局代码多列流法【教程】
更多>
最新教程
-
- Node.js 教程
- 16088 2025-08-28
-
- CSS3 教程
- 1546472 2025-08-27
-
- Rust 教程
- 23232 2025-08-27
-
- Vue 教程
- 25697 2025-08-22
-
- PostgreSQL 教程
- 22187 2025-08-21
-
- Git 教程
- 9172 2025-08-21
HTML5的模拟手电筒照明效果
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5模拟手电筒照明效果</title>
<style>
html, body {
height: 100%;
margin: 0;
}
svg {
display: block;
}
</style>
</head>
<body>
<svg width="100%" height="100%"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<filter id="light">
<!-- blur the source image to make bump map less sharp -->
<feGaussianBlur stdDeviation="3" result="blurred"></feGaussianBlur>
<!-- create bump map based on alpha channel -->
<feColorMatrix in="blurred" type="luminanceToAlpha" result="bumpMap"></feColorMatrix>
<!-- use bump map for lighting filter -->
<feDiffuseLighting in="bumpMap" surfaceScale="3" result="light">
<fePointLight x="225" y="150" z="30"></fePointLight>
</feDiffuseLighting>
<!-- compose the lighting result with source image using multiplication -->
<feComposite in="light" in2="SourceGraphic"
operator="arithmetic"
k1="1" k2="0" k3="0" k4="0">
</feComposite>
</filter>
<pattern id="pattern1"
width="450" height="300"
patternUnits="userSpaceOnUse"
>
<image xlink:href="img/codepen.jpg"
width="450" height="300"
></image>
</pattern>
<rect width="100%" height="100%"
fill="url(#pattern1)" filter="url(#light)"
></rect>
</svg>
<script>
const svgNode = document.querySelector('svg');
const fePointLightNode = svgNode.querySelector('fePointLight');
svgNode.addEventListener('mousemove', handleMove);
svgNode.addEventListener('touchmove', handleMove);
function handleMove(event) {
fePointLightNode.setAttribute('x', event.clientX);
fePointLightNode.setAttribute('y', event.clientY);
}
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5模拟手电筒照明效果</title>
<style>
html, body {
height: 100%;
margin: 0;
}
svg {
display: block;
}
</style>
</head>
<body>
<svg width="100%" height="100%"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<filter id="light">
<!-- blur the source image to make bump map less sharp -->
<feGaussianBlur stdDeviation="3" result="blurred"></feGaussianBlur>
<!-- create bump map based on alpha channel -->
<feColorMatrix in="blurred" type="luminanceToAlpha" result="bumpMap"></feColorMatrix>
<!-- use bump map for lighting filter -->
<feDiffuseLighting in="bumpMap" surfaceScale="3" result="light">
<fePointLight x="225" y="150" z="30"></fePointLight>
</feDiffuseLighting>
<!-- compose the lighting result with source image using multiplication -->
<feComposite in="light" in2="SourceGraphic"
operator="arithmetic"
k1="1" k2="0" k3="0" k4="0">
</feComposite>
</filter>
<pattern id="pattern1"
width="450" height="300"
patternUnits="userSpaceOnUse"
>
<image xlink:href="img/codepen.jpg"
width="450" height="300"
></image>
</pattern>
<rect width="100%" height="100%"
fill="url(#pattern1)" filter="url(#light)"
></rect>
</svg>
<script>
const svgNode = document.querySelector('svg');
const fePointLightNode = svgNode.querySelector('fePointLight');
svgNode.addEventListener('mousemove', handleMove);
svgNode.addEventListener('touchmove', handleMove);
function handleMove(event) {
fePointLightNode.setAttribute('x', event.clientX);
fePointLightNode.setAttribute('y', event.clientY);
}
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>
本站所有资源都是由网友投搞发布,或转载各大下载站,请自行检测软件的完整性!本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!如有侵权请联系我们删除下架,联系方式:admin@php.cn
