本文主要介绍水波动画的gif制作(flas),下面一起看看水波动画的gif制作(flas)相关资讯。
这是一个基于html5的3d水波动画效果。效果很逼真。我们可以按g和键让石头在水池里上下浮动,按l,再加上灯光效果的键,这样设计就相当完美了。同时这个3d动画是基于webgl渲染技术的,可以了解一下webgl。在线预览源代码,下载html代码,并将内容复制到剪贴板。javascript代码javascript代码将内容复制到剪贴板。函数water{ var =不同vec2坐标的顶点着色器;空(主){ coordinate = gl _ vertex . xy * 0 . 50 . 5;gl_position = vec4(gl_vertex.xyz,1);◎} ;;this . plane = gl . mesh . plane;如果(!gl . texture . canusefloatingpointtextures){放一个新的错误(本演示需要oes_texture_float扩展);} var filter = gl . texture . can use floating pointlinearfilteringgl . linear:gl . nearest;this.texturea =新总帐。texture (256,256,{type: gl.float,filter:filtering });this.textureb =新总帐。texture (256,256,{type: gl.float,filter:filtering });this.dropshader = new(顶点着色器,gl。有色常数浮点pi = 3.19973统一为sampler2d纹理;均匀的vec2中心;统一浮动半径;均匀的浮动强度;不同的vec2坐标;空(主){获取顶点信息vec4信息= texture2d(纹理坐标);◎将下拉项添加到高度浮动drop = max(0,1长度(中心* 0.5 0.5坐标)/半径);减少= 0.5-cos(减少*)* 0.5;信息。◎ gl_fragcolor =信息;} );this.updateshader = new(顶点着色器,gl。着色统一为sampler2d纹理;均匀vec2 delta不同的vec2坐标;空(主){获取顶点信息vec4信息= texture2d(纹理坐标);◎平均邻居身高vec2 dx = vec2(delta。x,0);◎ vec2dy = vec2 (0,delta,y);浮点平均值=( texture2d(纹理坐标的dx)。r texture2d(纹理坐标-镝)。r texture2d(纹理坐标r dx)。texture2d(纹理坐标dy)。r * 0.25◎改变速度移动到{平均值}信息=(平均值为r)* 2;◎稍微放慢速度,让浪赢了 不会永远持续下去。信息:g = 0.995◎沿速度移动顶点。信息。◎ gl_fragcolor =信息;} );this.normalshader = new(顶点着色器,gl。着色统一为sampler2d纹理;均匀vec2 delta不同的vec2坐标;空(主){获取顶点信息vec4信息= texture2d(纹理坐标);◎更新正常vec3 dx = vec3 (delta。x,texture2d(纹理,vec2(坐标x delta。x,坐标y))。r信息。r,0);vec3dy = vec3 (0,texture2d(纹理,vec2(x,y坐标,坐标系delta。y)).r信息。r,delta,y);info.ba =规格(cross (dy,dx))。xz;◎ gl_fragcolor =信息;} );this.sphereshader = new(顶点着色器,gl。着色统一为sampler2d纹理;统一vec3 oldcenter;统一vec3 newcenter;统一浮动半径;不同的vec2坐标;◎浮动volumeinsphere(vec3中心){vec3距离= vec3(坐标x * 2-1,0,坐标y * 2-1)中心;浮动t =长度(中心)/半径;浮点(= t,1.5,6);浮点ymin = min(0,居中。y dy);floating ymax = min(max(0,居中。y dy)、ymin 2 * dy);返回(ymax-ymin)* 0.1;;◎空(主){获取顶点信息vec4信息= texture2d(纹理坐标);◎在旧卷中添加信息。r = volumeinsphere(old center);◎新增量*减去信息。r = volumeinsphere(new center);◎ gl_fragcolor =信息;} );}水。prototype.adddrop = function (x,y,半径,强度){ reactive this _ = thisthis . texture b . draw to(function{this _ texture a . bind;这_ .dropshader.uniforms({ center: {,},radius: radius,strength: strength})。画画(这个_。平面);});this.textureb.swapwith (this。texture a);};water . prototype . move sphere = function(old center,newcenter,radius){ reactive this _ = this;this . texture b . draw to(function{this _ texture a . bind;这_ .sphere shader . uniforms({旧中心:旧中心,新中心:新中心,半径:半径})。画画(这个_。平面);});this.textureb.swapwith (this。texture a);};water . prototype . step simulation = function{ reactive this _ = this;this . texture b . draw to(function{this _ texture a . bind;这_ .update shader . uniforms({ delta:{ 1/this _)。texturea.width,1 / this_ .texturea高度}。})。画画(这个_。平面);});this.textureb.swapwith (this。texture a);};water . prototype . update normals = function{ reactive this _ = this;this . texture b . draw to(function{this _ texture a . bind;这_ .normal shader . uniforms({ delta:{ 1/this _)。texturea.width,1 / this_ .texturea高度}。})。画画(这个_。平面);});this.textureb.swapwith (this。texture a);};以上是本文的全部内容,希望能对大家有所帮助。救命。
了解更多水波动画的gif制作(flas)相关内容请关注本站点。
自己买配件组装手机,自己买零件组装手机行吗
电脑外壳裂开了修一下多少钱,电脑外壳坏了修理要多少钱知道的来谢谢
华硕主板f8进入不了u盘启动,电脑上没有U盘启动项目呀 我按F8没有 进入BIOS也没有 求解请
电脑硬盘内存满了怎么释放空间
安装w10系统卡住了怎么办(安装windows10卡住)
水波动画的gif制作(flash动画)
2021年手机性价排行榜(2021年手机性价比排行)
zuk z1怎么拆,ZUKZ1能更换电池吗
教你电脑怎么无线连接打印机教程(教你电脑怎么无线连接打印机视频)
英雄炉石传说伊莉丝怎么获得(炉石传说伊莉斯)
台式电脑在哪里连接wifi,台式机如何无线上网wifi
组装家用电脑什么配置好(家用组装电脑的主流配置)
三星s7抢红包怎么设置,三星手机抢红包设置
笔记本按G打出G5(g5的g键)
当贝投影仪连接电脑(当贝笔记本投屏)
电脑录视频没有声音怎么办(台式电脑录视频没有声音怎么办)
dnf深渊派对任务在哪里接(dnf深渊派对在哪里刷100版本)
怎么设置屏幕叠加层,ps将两个图层设置成叠加怎么弄啊
台式电脑在哪里连接wifi,台式电脑怎么连接wifi
hosts没有权限在此位置保存文件,请联系管理员(hosts 没有权限)