レールアプリケーションから Processing.js に値を渡す方法、 processing.js を使用して単純なキャンバスを作成しています
void drawBox(int bx, int by, int bs, int bs){
strokeWeight(3);
stroke(50,50,50);
// Test if the cursor is over the box
if (mouseX > bx-bs && mouseX < bx+bs &&
mouseY > by-bs && mouseY < by+bs) {
bover = true;
if(!locked) {
fill(181,213,255);
}
} else {
fill(255);
bover = false;
}
fill(192);
stroke(64);
roundRect(bx, by,80,30,10,10);
// put in text
if (!isRight) {
text("Box Value", x-size+5, y-5);
//Here i need to pass value from my controller
}
else {
text("Box Value", x+5, y-5);
//Here i need to pass value from my controller
}
}
静的文字列 "Box Value" の代わりに、ex @post.name から ajax を介して値を渡す必要があります