更多>
最新下载
24小时阅读排行榜
- 1 ipvsadm vip ARP 响应失败的 arp_ignore / arp_announce 配置
- 2 CSS 中的分号缺失:修复 Visual Studio Code 中的语法错误
- 3 vsftpd 500 OOPS: refusing to run with writable root inside chroot 写法
- 4 HTML 中相对路径的 src 属性导致请求地址错误:如何正确设置资源路径
- 5 html个人页面怎么加点赞按钮_html点赞交互逻辑实现【交互】
- 6 vm.dirty_background_ratio=5 后回写频繁的 vm.dirty_expire_centisecs 延长
- 7 html5可视化编辑兼容旧浏览器吗_html5可视化兼容处理法【方案】
- 8 如何正确禁用多个按钮元素以防止重复点击
- 9 html5怎么调整图片色温_html5色温调节前端法【技巧】
- 10 html5怎么给图片加水印_html5图片水印添加方法【步骤】
- 11 html5怎么实现图片裁剪_html5图片裁剪实现方法【步骤】
- 12 Linux Buffer 与 Cache 的真实区别
- 13 如何实现一个支持 yield from 的异步上下文管理器
- 14 ulimit -n 软硬限制不一致的 /etc/security/limits.conf vs pam_limits
- 15 firewalld 启动失败 "RuntimeError: Failed to load zone" 的 zone 文件损坏修复
更多>
最新教程
-
- Node.js 教程
- 16283 2025-08-28
-
- CSS3 教程
- 1546932 2025-08-27
-
- Rust 教程
- 23412 2025-08-27
-
- Vue 教程
- 25854 2025-08-22
-
- PostgreSQL 教程
- 22348 2025-08-21
-
- Git 教程
- 9309 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
