orzubalsky / creative-computing-2018

0 stars 1 forks source link

can someone take a look at my code? #105

Open danidls99 opened 5 years ago

danidls99 commented 5 years ago

For whatever reason, nothing I have put in my javascript file has shown up on my page. Could someone take a look at it? Even if this is completely wrong, wouldn't I have seen at least some sort of change on my page? It has been the same since I initially copied and pasted the code into the verb 2 file.


function hslColor(h, s, l) {  
  var hue = h;
  var saturation = s + "%";
  var luminance = l + "%";

  var color = "hsl(" + hue + "," + saturation + "," + luminance + ")";

  return color;

shape.style.background = hslColor(h, 100, 80);
shape.style.background-color = hslColor(h+30, .56, .82);

var layer1 = document.querySelector(".layer1");

layer1.style.background = hslColor(h, 100, 80);

var layer2 = document.querySelector(".layer2");

layer2.style.background = hslColor(h, 100, 80);

var layer3 = document.querySelector(".layer3");

layer3.style.background = hslColor(h, 100, 80);```
bajrushivlora commented 5 years ago

have you copied and pasted your code in to a javascript checker ? Maybe you could find a website online that can check for any errors !

danidls99 commented 5 years ago

hi thanks for the rec!

I tried and it said this: Expected an identifier and instead saw '0'. function randomNumber(0,350) {

which is referring to this in my code (sorry i forgot to paste this in the post above):

function randomNumber(0,350) {
  return Math.floor(Math.random() * (350 - 0 + 1)) + min;
}

I noticed that sublime highlights the closing parenthesis after the 350 in pink which I know means there is a problem. But I thought it would be 0 to 350 because I want my random variable to be for the hue which is specified by angle.

orzubalsky commented 5 years ago

Hi Dani,

Regarding the function, you should keep min and max inside the function parentheses as the parameters and inside the function body as well (between the curly braces), and then call the function with the values you want to use: randomNumber(0, 350);

On Mon, Oct 29, 2018 at 8:52 PM danidls99 notifications@github.com wrote:

hi thanks for the rec!

I tried and it said this: Expected an identifier and instead saw '0'. function randomNumber(0,350) {

which is referring to this in my code (sorry i forgot to paste this in the post above):

function randomNumber(0,350) { return Math.floor(Math.random() * (350 - 0 + 1)) + min; }

I noticed that sublime highlights the closing parenthesis after the 350 in pink which I know means there is a problem. But I thought it would be 0 to 350 because I want my random variable to be for the hue which is specified by angle.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/orzubalsky/creative-computing-2018/issues/105#issuecomment-434133086, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-ntSKEIs4FknhO6sN3koRPcOeVNQf6ks5up6LNgaJpZM4YA7CO .