paperjs - 如何在 html 中使用 paper.js 作为背景
问题描述
我正在尝试将“星星”示例用作 html 页面中的简单背景,页面上也包含 html 内容(我远未进入 js。简单的 html 和 css 处理是可以的)。
我必须放入什么: - css(单独或内联) - html 头 - html 正文
我只是在研究 .js 用作背景。我设法将鼠标参数作为定义星星代码的矢量。现在运行正常,但我要么只显示 .js 或缺少星星背景的 html 内容。提前非常感谢!
解决方案
这是我在我的 CSS 中设置的
body {
height: 100%;
margin: 0;
overflow: hidden;
}
canvas {
margin: 0px;
padding: 0px;
display: block;
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
}
希望这可以帮助
推荐阅读
- regex - 使用正则表达式选择文本匹配单词或模式之后的所有内容(类似的主题,但文本不是固定模式,除了 1 个字符)
- javascript - Expo React Native 错误:未处理的 JS 异常:清单必须指定 logUrl
- c# - C#如何用最后一个绘制的颜色填充两个GraphicsPath之间的交集?
- node.js - 使用 pm2 无法访问 ElasticBeanstalk 环境变量
- javascript - 在Vue路由器推送中使用表单模型
- javascript - 在反应中呈现嵌套 JSON 的最佳方法?
- python - 是否可以使用 python 在屏幕上识别文本“实时”而无需保存图像?
- c# - EDMX 中 Function 元素的 ReturnType “无效子元素”
- javascript - 在 node.js 和 Express 中使用 URL 参数
- jpa - Spring JPA 难删除