updating css with variable not working

hi guys.

finding my way with p5, help and resources are excellent however i've come to a point where i need some extra guidance.

what i'm trying to do is create a circle on the canvas that is a clickable link that i can dynamically update the colours of the two states. the circle is defined in the class ' one'.

i have this p5 code :

sendLink = select('.one'); sendLink.mouseMoved(updateCss); sendLink.mouseOut(updateCssBack);

function updateCss(){
function updateCssBack(){
sendLink.style('background-color', 'rgba(23,120,45,0.5)');

this works great.

elsewhere in my code i have three variables controlling r,g,b values of some triangles. what i'd really like to do is parse the variable values into one of the functions so when the mouse moves over and out the colour of the dom element is the same as the triangle.

simply replacing the numeric values with r , g, and b sees no change in colour. i don't get any error messages even.

i've tried using ' + r ' for example and that doesn't work.

am i trying to do something that i shouldn't be trying to do ?

how can i get the variables into the rgba section of code and for it to work ?


Sign In or Register to comment.