实现步骤 设置Sheet页背景 添加JS代码 在每个Sheet页的body组件中,添加相同的初始化后事件,粘贴以下代码(需完整包含动画逻辑):
| function background() { |
| $("body").prepend('<canvas id="canvas" style="position:absolute;z-index:-2;"></canvas>'); |
| var canvas = document.getElementById('canvas'), |
| ctx = canvas.getContext('2d'), |
| w = canvas.width = window.innerWidth, |
| h = canvas.height = window.innerHeight, |
| hue = 217, |
| stars = [], |
| count = 0, |
| maxStars = 800; |
| // 完整代码见{{JS实现大屏旋转星空背景-3043.md}} |
| animation(); |
| } |
| background(); |
| $(window).resize(function() { background(); }); |
同步所有Sheet页
注意事项 效果预览: 如需完整代码或模板,可参考:大屏旋转星空背景图.frm。
|