【原创】AS3-->滤镜

AS3编程

目前由于工作需要开始flash AS3编程,以后一段时间将总结flash AS3编程的一些技巧和一些类的使用方法:

AS3代码:

 import flash.display.Sprite;
import flash.filters.BitmapFilterQuality;
import flash.filters.BlurFilter;
// 绘制一个圆。
var redDot:Sprite = new Sprite();
redDot.graphics.lineStyle();
redDot.graphics.beginFill(0xFF0000);
redDot.graphics.drawCircle(145, 90, 25);
redDot.graphics.endFill();
// 将该圆添加到显示列表中。
addChild(redDot);
// 对矩形应用模糊滤镜。
var blur:BlurFilter = new BlurFilter();
blur.blurX = 10;
blur.blurY = 10;
blur.quality = BitmapFilterQuality.MEDIUM;
redDot.filters = [blur];

 

运行后的结果:

 2334553456838692295.jpg

 

PS :

       想想在大学的时候学flash动画的时候,还基于时间轴的概念,现在技术的不断的进步,ADOBE公司现在已经完全基于AS3的编程,用起来比AS2还要简单还要省事,而且操作起来还要方便。恩不错,l like it very much~

作者:小盒子
时间:2008.07.20
地点:大连
转载说明:转载请表明作者以及出处,对于本博客的技术仅供参考。

内容概要:本文介绍了一个基于Matlab的综合能源系统优化调度仿真资源,重点实现了含光热电站、有机朗肯循环(ORC)和电含光热电站、有机有机朗肯循环、P2G的综合能源优化调度(Matlab代码实现)转气(P2G)技术的冷、热、电多能互补系统的优化调度模型。该模型充分考虑多种能源形式的协同转换与利用,通过Matlab代码构建系统架构、设定约束条件并求解优化目标,旨在提升综合能源系统的运行效率与经济性,同时兼顾灵活性供需不确定性下的储能优化配置问题。文中还提到了相关仿真技术支持,如YALMIP工具包的应用,适用于复杂能源系统的建模与求解。; 适合人群:具备一定Matlab编程基础和能源系统背景知识的科研人员、研究生及工程技术人员,尤其适合从事综合能源系统、可再生能源利用、电力系统优化等方向的研究者。; 使用场景及目标:①研究含光热、ORC和P2G的多能系统协调调度机制;②开展考虑不确定性的储能优化配置与经济调度仿真;③学习Matlab在能源系统优化中的建模与求解方法,复现高水平论文(如EI期刊)中的算法案例。; 阅读建议:建议读者结合文档提供的网盘资源,下载完整代码和案例文件,按照目录顺序逐步学习,重点关注模型构建逻辑、约束设置与求解器调用方式,并通过修改参数进行仿真实验,加深对综合能源系统优化调度的理解。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <style> body { margin: 0; height: 100vh; background: url("引用自己的背景图") center no-repeat; background-size: 100% 100%; } .glass-container { position: fixed; overflow: hidden; box-shadow: 0 6px 6px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 0, 0, 0.1); border-radius: 200px; width: 200px; height: 200px; background: rgba(255, 255, 255, 0.25); } .glass-filter { position: absolute; inset: 0; z-index: 0; backdrop-filter: blur(4px); filter: url(#lg-dist); /*创建独立渲染区,防止影响容器中的内容*/ isolation: isolate; } .glass-specular { position: absolute; inset: 0; z-index: 2; border-radius: inherit; overflow: hidden; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.75), inset 0 0 5px rgba(255, 255, 255, 0.75); } </style> <body> <!--玻璃容器--> <div class="glass-container"> <!--使用液态滤镜--> <div class="glass-filter"></div> <!--边沿效果--> <div class="glass-specular"></div> </div> <!--创建液态滤镜--> <svg style="display: none"> <filter height="100%" id="lg-dist" width="100%" x="0%" y="0%"> <!--生成噪声图案--> <feTurbulence baseFrequency="0.008 0.008" numOctaves="2" result="noise" seed="92" type="fractalNoise"/> <!--模糊噪声--> <feGaussianBlur in="noise" result="blurred" stdDeviation="2"/> <!--根据模糊噪声的处理结果,形成扭曲效果--> <feDisplacementMap in="SourceGraphic" in2="blurred" scale="70" xChannelSelector="R" yChannelSelector="G"/> </filter> </svg> <script> window.onload = () => { const container = document.querySelector(&#39;.glass-container&#39;) document.onmousemove = (e) => { container.style.left = e.x - 100 + &#39;px&#39; container.style.top = e.y - 100 + &#39;px&#39; } } </script> </body> </html> 在safari中没效果
07-04
在 Safari 中,`backdrop-filter` 和 SVG 滤镜(`filter`)的支持可能存在兼容性问题。以下是针对 Safari 的兼容性调整方案: ### 修改后的代码 ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <style> body { margin: 0; height: 100vh; background: url("引用自己的背景图") center no-repeat; background-size: 100% 100%; } .glass-container { position: fixed; overflow: hidden; box-shadow: 0 6px 6px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 0, 0, 0.1); border-radius: 200px; width: 200px; height: 200px; background: rgba(255, 255, 255, 0.25); /* 添加 Safari 兼容前缀 */ -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); } .glass-filter { position: absolute; inset: 0; z-index: 0; /* 禁用 SVG 滤镜(Safari 可能不支持) */ filter: none; isolation: isolate; } .glass-specular { position: absolute; inset: 0; z-index: 2; border-radius: inherit; overflow: hidden; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.75), inset 0 0 5px rgba(255, 255, 255, 0.75); } </style> <body> <div class="glass-container"> <div class="glass-filter"></div> <div class="glass-specular"></div> </div> <!-- 移除 SVG 滤镜(Safari 不兼容) --> <script> window.onload = () => { const container = document.querySelector(&#39;.glass-container&#39;); document.onmousemove = (e) => { container.style.left = e.x - 100 + &#39;px&#39;; container.style.top = e.y - 100 + &#39;px&#39;; }; }; </script> </body> </html> ``` ### 关键修改点 1. **`backdrop-filter` 前缀** Safari 需要 `-webkit-backdrop-filter` 前缀,同时保留标准属性。 2. **移除 SVG 滤镜** Safari 对 SVG 滤镜(`<filter>` 和 `feDisplacementMap`)的支持较差,直接禁用。 3. **简化玻璃效果** 通过 `background: rgba(255, 255, 255, 0.25)` 和 `-webkit-backdrop-filter: blur(4px)` 实现基础毛玻璃效果。 ### 其他建议 - **测试 Safari 版本** 确保用户使用最新版 Safari(旧版本可能完全不支持 `backdrop-filter`)。 - **备用方案** 如果必须使用复杂滤镜,可通过 JavaScript 检测 Safari 并替换为静态效果(如半透明背景)。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值