更多>
最新下载
iPicker多级联动城市选择组件
jQuery iPicker城市选择插件,利用json动态调用城市地区数据,支持多级联动城市选择,设置获取值选择结果。这是一款简单快速的对 “省市区” 城市选择代码。ps:使用ajax本地要在localhost才能正常访问。
0
2026-01-27
24小时阅读排行榜
- 1 css 颜色叠加效果是如何计算的_从透明度与背景混合角度解析
- 2 html5播放rtsp能语音对讲吗_html5rtsp双向语音实现【功能】
- 3 如何精准选中表单输入框_结合类型属性和类实现
- 4 Go语言新手第一个项目怎么写_Golang入门项目实战思路
- 5 php怎样判断变量是否为整数_php判断整数类型方法【示例】
- 6 php判断字符串长度返回整数吗_php返回值类型说明【教程】
- 7 Golang网络编程如何处理并发连接_Golang高并发服务器设计
- 8 javascript中的数组如何使用?_学习javascript数组操作方法【教程】
- 9 html5布局代码网格对齐细节_html5布局代码grid对齐技巧【步骤】
- 10 html5play函数播放结束回调怎写_html5play函数结束回调法【步骤】
- 11 如何在克隆网站中正确加载CSS及Web字体资源
- 12 如何在 Go 中高效实现超长二进制字符串的按位 OR 运算
- 13 css margin 折叠和盒模型有什么关系_利用垂直方向计算规则说明
- 14 css grid如何快速制作仪表盘布局_通过网格区域灵活分配
- 15 php怎么连接数据库取数做图表_phpMySQL查数据绘柱状图法【步骤】
更多>
最新教程
-
- Node.js 教程
- 16253 2025-08-28
-
- CSS3 教程
- 1546876 2025-08-27
-
- Rust 教程
- 23388 2025-08-27
-
- Vue 教程
- 25837 2025-08-22
-
- PostgreSQL 教程
- 22325 2025-08-21
-
- Git 教程
- 9291 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
