+ 4

My code>>>>>>

Okay,so I have this code in js, and I have checked it on another website..... and it wokrs, the problem is..... I feel like I dont have functions to work, my main deal is that im trying to get color into my code, but I've tried fill, and a color var, but it wont work, if anyone could exam this code, and maybe give me help, that would be much aprecciated!!!! function setup() { creatCanvas (400,400); } var centerX = 200; var centerY = 160; var bodyLength = 118; var bodyHeight = 74; var bodyColor var bubblesX = 254; //Small bubble var bubblesY = 27; //SmallbubbleY draw = function() { background(89, 216, 255); Stroke(10); fill(bodyColor); // body ellipse(centerX, centerY, bodyLength, bodyHeight); // tail var tailWidth = bodyLength/4; var tailHeight = bodyHeight/2; triangle(centerX-bodyLength/2, centerY, centerX-bodyLength/2-tailWidth, centerY-tailHeight, centerX-bodyLength/2-tailWidth, centerY+tailHeight); // eye fill(33, 33, 33); ellipse(centerX+bodyLength/4, centerY, bodyHeight/5, bodyHeight/5); centerX= centerX +1; centerY = centerY -1; fill(250, 247, 247); ellipse(bubblesX,bubblesY,40,40); ellipse(bubblesX, bubblesY + 45, 20,20); ellipse( bubblesX, bubblesY + 70,5 ,5); bubblesY = bubblesY - 1; //bubble rising };

31st Aug 2017, 1:44 AM
Isaiah Trembley
Isaiah Trembley - avatar
1 Antwort
+ 2
The only thing I can see wrong in the code in this post is that your are missing a semicolon for var bodyColor and it is never set before it is used in fill(bodyColor); Is this P5.js? Other than that I can't see where all the values are set to the canvas. (unless it's P5). Can't really help further without actually being able to run the code in its entirety (HTML, JavaScript, CSS, etc) as this code does nothing on its own in the playground.
31st Aug 2017, 8:07 AM
ChaoticDawg
ChaoticDawg - avatar