LAF dropshadow and scale? + FREE Knob Snippet
-
I have two questions :) How can i create a drop shadow below my circle panel?
And is it possible to create scales around the knobs using laf? see my example.HiseSnippet 1793.3ocsXs0aaaCElJMps1acnCXOrG1CDFX.NoNtR1IoqnncN2bWPZSyh6kUDz0QKQayFYRCI5zjsUf8SXuu8yXOrG2iCE6Gy19CjcHkjEkuzzks5GTBOWH+9NmCIOR6EJ7nQQhPjUgGdx.Jx58sacBW1aidDFGs8lfb6cDsw2asln0OY.IJh5irrtvcUpsJLOR+6O+70IADtGMSDB8XAyidOVelLS5dM1gEDzj3SeHqug0K2XaOAeCQfXH.kKX6fFP7NjzktKQY1b1HqKtkOSJBaIIRZDxZ90E9mzpm3k7X6eLKh0NfpF3hZASTr3lh.eEhURQaziE3uWJkiPvrrWV.3BwAfOx99Le1H4YAhqpUfy7vLdXMWd3cgbvy0DdNFvaJPxx.RyGCoOztkWHafLSiBOum81bIMrCAB6lPI1Vzb+7ks2P.VvkU6SNj1LDFLxixq53TAuriyB2pn520uN9dBORfJQWDREQRbnPRBO44AjN3ai2h2kwoU8Bo.+tafnMIHdctmPb3Zb+lTZPY8bAyDtU.ymFFULaJpFR6xhfEu4PtmjI3kK4GRd49ZChMuTEbmTkcqfEsewBE+tTvsVnGdGtncwBrN3xftpR5wR7suMtDn54pxwR3u+6wSnYyP1Qzoq5Ijv9xdkVnHF98c5mGQBw6.zMMvEy28HxdJxkZw.2yzjPBuKErRsn8IGiWJ9+X7XSFYWDve4C5zIhB3BWq5xYSAIz6g8XdGxgTNnyopS8bJeByW1CT3V0Al9ZvyEy4SrwIq0.2pdATRnNGUPMCTt+n0cISXbsj4xT1hZ3eDIXHcWQXeR.6ao9iQEPKLUkJAKvHTlDAHPLJC6ubpRCEC49pXPlHE6HGT+YFKjtPkzlFfeHjJKVnaU.dwmanqJXRZ+3gt.SiU2DxTkK8fiOoKki2m1cX.QUr4txB2BqLQUHtV.qKm5qlzQUWPM6f.0dEc0B3QoRKTAe.4.mmUQiqkHGT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vyXu2a3f3+S4x3R6h1oufIxDkfEOZx5ySS.+XE5nIem9qZeegO7lHx7ehA05jn.tFM260qd2cdDSdh4l3+29tCusP7Cs2iI85McLN2Tvn5V22AXL4q0bE6s5zA5EKCfya27qd27oYPPueRFu68IxP0wV16NreKHw6QgUmC6uTswXMmpFMdriZrJBzBZHUOPUejnzUM1JQoapRnxwKT7bu3dMTeOnKqk.Xhq+TXEruuZLdTSF11P+fn9Le1y87TzeIWDZ59T6b3S8ygOKeN7YkygOqdN74FmCe9r2nOpuJ3ZCkh9waG.A6sktYOKqs3DnxRWEh9G.LloZF
Feel free to share my knob that is a modification from @orange s LAF collection. If i am done with this i will share the result in the collection aswell :)
Any tips and tricks are appreciated.
-
@Straticah The most sane approach to this would be a monochromatic path with the scale lines that you import and use
Path.loadFromData()
. You can compute the scale but there's quite a bit of trigonometry involved. -
@Straticah You have 2 options here : either 1) draw everything in the LAF function or 2) draw each parts in different panels. It's your choice but with option 2, you'll quickly get lost when building big GUIs .
I changed some things in your original snippet : if you're painting everything in one LAF function you have to leave room for the shadow and the scales.
I did it quickly, there should be room for further improvements.
HiseSnippet 2489.3oc6Yr1aaibjxwL4jxcEIn8yEKDPQkcjjondDmllbxx1JmgcbbsxkzTC2zUjqj1ZJtpjT1wMW.xOp9Cn+.5+jh.bn.8yoyr7snjegK.EEU1lV6ryNumYmc4ANBClqqvQIW9Wd9DlRtuVs241di1bDkaqryV.b0cE8I6sQWkNmOg55xLUxk6VOCmNW9kUje9wusC0hZavhAon7JA2fsGeL2KF5As2kaY0kZxdIebBrazdGCg8lBKwTPTtkplxDpwIzgr8oHZKopj61aax8DN87ndLWkbK2QXdduQhyr8w+UbWdeKFNnlROfP9f6JrLQIFgpr4Htk4AgprqBPkChM.2x2.7KTeN2jGAO1PbO4Dj3Ujzdjaozh2sRId0RJdZIDu4HR4RHRK6KR2WsmgCehW7Ln7bW0cr8XNCnfYOon3iqxR0+4paJ.Lr8pNldBqqCLHZEkZooUlzPSakGWnvZqQ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bZn5IAeZneL2sTtJpyWoJ+dsjJzVIUH6YUncxnP6zNsHN5O954Ih.DI34q8Mlq1Wrcbgf.Z3+IgtU3RzM8j51NIzs1hY0smlQ2d5L5VnRLitc3te20V29wuMoV7MWRBxhB3dpzBg2ZdTG4Jo0pO96lUq.HPeyIIn6zAC3.jkUI+pY0s6bm674rwggNYS1.5TKuWkHETxfvVSPIqotl1ip25QMS42t8h7a2UM5VzSn1e78Icc+oYbcs+CYTxiZecx.ZjjUzKLC3MYhRdyUKCHzRN+X54EiTaA0J1Yd51ETgLgt8WRG8bEzM+.rBpgGFTI12Jk9uewQGyDls.6QRc4quD+T8jYBlICIlLqtreFcY+eJxleZ6j5+m+ruJj1m9u9G+Mxh7ojT9N0KNKPdQcKJK.Jrj0aoj88rcO0mKLgyr4k909g9xfIfdHR8t1v2mlsK267jkq9I6cAdUEw6qd.2yXz7kwkliLhsb7EPFCdCpei51CF.cdFKfKq182+k40kp3+RuF9bpmCVXVc+oi6AAWFLf61PLB1CWtkvbG+wZ3XzBzCZ+VN.hL+bvj0vw4BlrV3jP1ogi3sF9MZgui1uRBAjIa4qmNu5ywwjnNrTUgteUFyM4u0v.U+J0TTl+ZzuAqo9MXMMtAqo4MXMstAq4g2f0r9EtF7M0uwTOwX+zA.vAaK6zMWtssw2zfLJT4+X7qJHK
-
@Christoph-Hart I remember rendering the scales with a path. It didn't work out as expected (just an arc but no scales), but I could have done it wrong.
-
@Matt_SF Yes it's easy to mess up the aspect ratio and then you'll get a scaled egg.
I found that function to be pretty useful, you give it the dimensions of a path (using
Path.getBounds()
) and a target Rectangle and it returns a rectangle that fits directly in the target area./** returns a copy of the `area` rectangle with the same aspect ratio as the `otherArea` rectangle. > This is useful in order to fit a path into a given rectangle without skewing its aspect ratio. */ inline function withAspectRatioLike(area, otherArea) { local ar = otherArea[3] / otherArea[2]; local w = area[2]; local h = area[2] * ar; local x = area[0]; local y = area[1] + Math.abs(h - ar[3]) / 2.0; if(ar > 1.0) { w = area[3] / ar; h = area[3]; x = area[0] + Math.abs(w - area[2]) / 2.0; y = area[1]; } else { w = area[2]; h = area[2] * ar; x = area[0]; y = area[1] + Math.abs(h - area[3]) / 2.0; } return [x, y, w, h]; }
-
@Matt_SF wow that is sick! great job, looks like a lot of work getting it to align perfectly looks great!
@Christoph-Hart thats true, dont know how to use this yet since i am a beginner but i can work with what i have now and explore this in the future thank you both :) -
@Christoph-Hart Ah, awseome ! Thanks
-
@Straticah said in LAF dropshadow and scale? + FREE Knob Snippet:
@Matt_SF wow that is sick! great job, looks like a lot of work getting it to align perfectly looks great!
Haha yes, I had to fiddle around with the values but once you got it...