var boat,groundImage; //variables declared
function preload(){
boat = loadAnimation("b2.png"); //loading animation
groundImage = loadImage("b1.jpg");
}
function setup() {
createCanvas(600, 400); //draw canvas
}
function draw()
{
background(180);
image(groundImage,0,0);
animation(boat,0,0); //locate animation
}下面是在p5.js编辑器中使用动画的简单代码。但是我得到了一个错误: ReferenceError: loadAnimation没有在/sketch.js:6:3中定义
发布于 2021-07-21 04:19:16
loadAnimation()函数不是p5.js的组成部分。它由p5.play add-on添加。我只能假设您忘记在index.html中添加对p5.play的引用,因为您没有包含minimal, reproducible example。
<script src="https://molleindustria.github.io/p5.play/lib/p5.play.js"></script>https://stackoverflow.com/questions/68460387
复制相似问题