Place a rectangle (polygon) on top of an image online

You can just keep everything the same, where you set the position on each routine using your conditions file using the polygon dialog box. Also, I realise now that you do not actually need the above code, you can just use the following code for setting the fill color as transparent in the “Begin Routine” tab.

polygon.setFillColor(undefined) 

You could set the transparency from your conditions file. If you have a column called fillCol and use values such as “white”, “black” or undefined, and use the following in the “Begin Routine” tab, things should work. It works by only creating a new color and using it, if an actual color is given.

let nextCol = (fillCol === "undefined" || fillCol === undefined ? undefined : new util.Color(fillCol))
polygon.setFillColor(nextCol);
1 Like