Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Morgan Sweeney
Ant Collector
Morgan has collected ants since they were six years old and now has many dozen ants but none in their pants.
like
trade
close
css
body { padding:0; margin:0;background-color: #D1FEFF; } .card { display:none; width:300px; height:500px; } canvas { width:100vw; height:100vh; display:block; filter:drop-shadow(0 1px 30px rgba(0,0,0,.2)); }
JavaScript
; (async () => { const IMG_W = 300; const IMG_H = 500; const engine = new BABYLON.Engine(elCanvas, true); const scene = await (async () => { const html = document.querySelector('.card').outerHTML; const rasterizeResult = await rasterizeHTML.drawHTML(html, { width: IMG_W, height: IMG_H }); const scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color4(0, 0, 0, 0); const mat0 = new BABYLON.PBRMetallicRoughnessMaterial('mat0', scene); mat0.baseTexture = new BABYLON.Texture.LoadFromDataString('tex0', rasterizeResult.image.src, scene, true, false, false, BABYLON.Texture.TRILINEAR_SAMPLINGMODE); mat0.roughness = 1; mat0.baseTexture.hasAlpha = true; mat0.backFaceCulling = false; // create ribbon const width = 1; const height = (width * IMG_H / IMG_W); const pathArray = []; const infoArray = []; const subX = 100; const subZ = 20; for (let i = 0; i < subZ; ++i) { pathArray[i] = []; infoArray[i] = []; for (let j = 0; j < subX; ++j) { const xRatio = j / (subX - 1); const px = (xRatio - 0.5) * width; const zRatio = i / (subZ - 1); const pz = ((1 - zRatio) - 0.5) * height; const vertex = new BABYLON.Vector3(px, 0, pz); pathArray[i][j] = vertex; infoArray[i][j] = { px, pz, i, j, xRatio, zRatio }; } } const mesh0 = BABYLON.MeshBuilder.CreateRibbon('mesh0', { pathArray, closeArray: false, closePath: false, updatable: true, frontUVs: new BABYLON.Vector4(0, 0, 1, 1), sideOrientation: BABYLON.Mesh.FRONTSIDE }); mesh0.material = mat0; mesh0.rotation.x = -Math.PI / 2; mesh0.mustDepthSortFacets = true; let t = 0; let freq = 2; let ampY = 0.05; let ampX = 0.01; mesh0.onBeforeRenderObservable.add(() => { for (let i = 0; i < subZ; ++i) { for (let j = 0; j < subX; ++j) { const vertex = pathArray[i][j]; const info = infoArray[i][j]; vertex.y = Math.sin((t + info.xRatio) * freq * Math.PI * 2) * ampY; vertex.x = info.px + Math.sin((t + info.zRatio) * freq * Math.PI * 2) * ampX; } } BABYLON.MeshBuilder.CreateRibbon('', { pathArray, instance: mesh0 }); mesh0.updateFacetData(); t += 0.01; }); const camera = new BABYLON.ArcRotateCamera('camera', -Math.PI / 2, Math.PI/2.6, 2, new BABYLON.Vector3(0, 0, 0), scene); camera.attachControl(elCanvas); camera.wheelPrecision = 100; const light0 = new BABYLON.SpotLight('light0', new BABYLON.Vector3(-2, 0, -10), new BABYLON.Vector3(1, 0, 1), 90 * Math.PI / 2, 1, scene); light0.intensity = 1000; light0.diffuse = new BABYLON.Color3(1, 1, 1); return scene; })(); engine.runRenderLoop(() => { scene.render(); }); addEventListener('resize', () => { engine.resize(); }); })();
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>3d反转加飘动效果-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号