更多>
最新下载
西山居首页jQuery焦点图代码
西山居首页jQuery焦点图代码是一款带文字描述,左右箭头,索引按钮,自动轮播切换的jQuery特效代码。本作品由【站长素材】收集整理,转载请注明出处!
0
2026-01-25
24小时阅读排行榜
- 1 如何让网格容器中的子元素显示统一渐变背景,而容器空白区域保持白色
- 2 如何将 UTC 时间准确转换并显示为浏览器本地时间
- 3 如何在 Go 中安全执行多语句 SQL 脚本(含文件加载与事务处理)
- 4 基于URL的搜索词短语聚类:高效内存实现方案
- 5 如何优化 WooCommerce 价格显示以减少 DOM 元素数量
- 6 html5滤镜如何实现素描风格_html5素描滤镜实现思路【技巧】
- 7 FIMO输出HTML包含文本行高吗_FIMO输出HTML行高参数说明【说明】
- 8 html5播放rtsp支持哪些浏览器_html5rtsp兼容浏览器清单【说明】
- 9 html5怎么实现图片混合模式_html5混合模式效果教程【技巧】
- 10 html个人页面怎么加折叠菜单_html手风琴菜单代码【组件】
- 11 html5滤镜如何让颜色反转_html5颜色反转滤镜法【步骤】
- 12 html个人页面怎么加404提示_html错误页编写教程【页面】
- 13 PHPMailer SMTP 配置指南:OVH 主机环境下的正确邮件发送方案
- 14 如何让网格容器中的子元素显示统一渐变背景,而容器空白区域保持纯白
- 15 html5play函数调用需加前缀吗_html5play函数前缀使用法【步骤】
更多>
最新教程
-
- Node.js 教程
- 16094 2025-08-28
-
- CSS3 教程
- 1546480 2025-08-27
-
- Rust 教程
- 23235 2025-08-27
-
- Vue 教程
- 25700 2025-08-22
-
- PostgreSQL 教程
- 22189 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
