Drawing SVG's inside panels by using arrays in a loop?
-
I've been trying to draw SVG images inside panels using arrays inside a loop but with no success.
Here is the simple, working code for 3 panels and 3 svg's:
const var IconPanel0 = Content.getComponent("IconPanel0"); const var IconPanel1 = Content.getComponent("IconPanel1"); const var IconPanel2 = Content.getComponent("IconPanel2"); IconPanel0.setPaintRoutine(function(g) { g.drawSVG(IconPaths.KickIconPathSVG, this.getLocalBounds(0), 1.0); }); IconPanel1.setPaintRoutine(function(g) { g.drawSVG(IconPaths.SnareIconPathSVG, this.getLocalBounds(0), 1.0); }); IconPanel2.setPaintRoutine(function(g) { g.drawSVG(IconPaths.HatsIconPathSVG, this.getLocalBounds(0), 1.0); });
Is it possible to simplify this using arrays of panels and SVG names?
Ideally, by utilizing something like this to get references for the panels:
const var PanelArray = [Content.getComponent("IconPanel0"), Content.getComponent("IconPanel1"), Content.getComponent("IconPanel2")];
This would allow me to scale the number of panels and SVG's easier.
-
-
Here's another way to do it, if you don't need as much independent control
HiseSnippet 793.3ocsUstZSDDEdlzrglnUrfO.KAD1B0PRuofH11bQBZaWL0h+qLc2IICc2YV2c1pKh+y2Ge0D7AndlY1bqMDaBX9QXOW9NmuYNWF2XgGMIQDivkOOKhhvO1pWFWNr4PBii51Bgeh0IjDIM11n53rHRRB0Ggwq8NkBb4hH8ue+1iIADtGchJD5BAyi9AVHSNQq6gumEDzg3SOmENk26cXWOAuoHPjB7YMq5nHh20jAzSIJ2JXgvkZ6yjh3dRhjl.9brvOq2PwW4F+ufkvtJfpDZf5AAxnF0bHKv2czYMAgvEcmbxWybxel0ILe1X8StAdp1f8DDSeGfKrHJ0XInDdJJUzPoMs54EyhjSrn3yir5xgBReBbUOMUL9hJ7ErUSA3AWVKjbMsSLHLFgyA0qusM72VutRk9obOISvsCybgSq7ihTIiScFrUkuWo7fZ8g5zQAANxgrjZCnRmpWMvTeptEf+GUp.ErDocDgSCRrei8n7B9B3ZJBiDbPNwopqxkp5jJhschrY7bX5bEUKgJmgCyRIc1FSWA+TgjdF2QiErXeWS86OWaJ9EKBBnwy0rpeLdQ.c3ogWQi219FRPJcriPAa1tfROrt.Oy00TNJ3c4L4YQzb4Nh.eU0U8886YP422vWepaKhjnZix0A9EQikLEcvsn2.ygllpxVsnIWKEQPTGWgPXKo15FiZ4T0FDCR85V5uaf9F3D9mPtxTenR5ntAHnkfE.2pGiWhXtiIlEw4wrD9Nw7OatzwbWSLe9nX9q6DyaQ6ah48G2fAcgeZ.QN6zuZMWtAnYXlQN0XEOgIyldM3RrRn9BWI7Po3lVtLo2v4ywBygiPax+CNluHcCq186S8jSHXQqNedU2Z9ORuY+vfSHxXlpveZZXOnR6QgryUqWT8.ETsPF45JY0MPOJ2WKbK7K2XCkLN2XiQFQgDuXwkdlU.pU0qq0.bhqeYpL7DIHa2.oWK.3rpWqNJDd03ROO0w+Evz67wryJfY2U.ydq.l8WALGrBXd4Jf4UKDi5A6iRkhPy3.nvssd+HF2lSfNKcWH5uPqPagB
-
@d-healey Thanks, Dave.
Unfortunately, this doesn't solve my challenge. I haven't figured out how to properly loop through 2 arrays for drawing SVG's inside panels.I guess I'll just stick to the manual way I have above. It is not too laborious.