如何调用mousemoved的paintcanvas函数INSIDE [英] How do I call the paintcanvas function INSIDE of mousemoved
问题描述
设置新属性值后,请务必调用mouseMoved()的paintCanvas函数INSIDE,以便在新位置的画布上绘制图像!移动鼠标以检查它是否有效。
(报告问题)
??
1
2
3
4
5
$
7
8
9
10
11
12 br / >
13
14
15
16
$
18
19
20
var paintBrush = {
x:150,
y :250,
img:getImage(avatars / piceratops-ultimate)
};
var mouseMoved = function(){
paintBrush.x = mouseX;
paintBrush.y = mouseY;
};
var paintCanvas = function() {
imageMode(CENTER);
image(paintBrush.img,paintBrush.x,paintBrush.y);
};
paintCanvas();
我尝试过:
i现在尝试了很多东西,但我现在还不知道
After you set the new property values, make sure to call the paintCanvas function INSIDE of mouseMoved() so that the image is painted on the canvas at the new location! Move your mouse to check it works. 这篇关于如何调用mousemoved的paintcanvas函数INSIDE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
x:0,
y:0,
img:getImage(avatars / piceratops-ultimate)
};
var mouseMoved = function(){
paintBrush.x = mouseX;
paintBrush.y = mouseY ;
paintCanvas();
};
var paintCanvas = function(){
imageMode(CENTER) ;
image(paintBrush.img,paintBrush.x,paintBrush.y);
};
(Report a problem)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var paintBrush = {
x: 150,
y: 250,
img: getImage("avatars/piceratops-ultimate")
};
var mouseMoved = function () {
paintBrush.x = mouseX;
paintBrush.y = mouseY;
};
var paintCanvas = function() {
imageMode(CENTER);
image(paintBrush.img, paintBrush.x, paintBrush.y);
};
paintCanvas();
What I have tried:
i have try lots of stuff for now but i still don t nowvar paintBrush = {
x: 0,
y: 0,
img: getImage("avatars/piceratops-ultimate")
};
var mouseMoved = function () {
paintBrush.x = mouseX;
paintBrush.y = mouseY;
paintCanvas();
};
var paintCanvas = function() {
imageMode(CENTER);
image(paintBrush.img, paintBrush.x, paintBrush.y);
};