Change color in a loop with i-variable?



  • Is it possible to change colors (0xff986734 * i ???) in a sensible way in a loop so that the color changes gradually with increasing i-values?

    πŸ™

    urs

    for (i = 0; i < NumOfSteps; i++)
    {
         this.data.play == i ? g.setGradientFill([0xffFF1236 , 0, 250, 0xff737170, 0, 10]) : g.setGradientFill([0xffFF5126, 0, 250, 0x98528170, 0, 10]);    
         g.fillEllipse([offset + StepSize * i + 1, (1 + xy[i] + param2[i]), 3, 3]); 
    }
    


  • @UrsBollhalder I'm working on something similar for me too, If I get something working I'll make a snippet πŸ˜‰



  • @ustk Awesome! Thx!



  • @UrsBollhalder Here's a very limited one (only blue to black) to get an idea

    HiseSnippet 981.3ocsV01aaaCDlxwZnVccXEX+.H5mjSbSncRZyPZPcicxlwVREl65JZQQACEkMQjIEnnamwP9Ou+AaG0KVxqdYoFXBI.5t64N+buviJPqX7zTkF4z5UKR3Hmu1c7BoY5foTgDMZHx4abuflZ3ZbtpSWjPSS4gHGms9AqBmVMQYO+4yOkFSkLdkJD50JAi+yhYBSk1f9+jHN9bZH+UhY0PeP+QLkbfJVMG3yVtDTBkcMcB+RpEVCWjyWcVnvnziMTCOE4z7TU3hwSUeRli+0hTwUwbqPWzXHP4pOWEGZYrUKZvTQbXPYdmhfnDTUE1JuJ7ctWHBEK0WUM91LC3JOpWObZbazq6+M8HqidN0nWyb58P2wLsHwTYwxs66NRBMpHJzBpSqbrnFM2xcfBPHM6NidM+bMHrzC+mPHcvGRHsO1yCZCoF7GoZb.Uxi6hOAW54DtYfZVhRBB9OJ27ir9XQy.kZNfNWuE7uIBMS8auWuRHYsWaDOn2SOp62S1e+COFu2dXxahhHvSTD9p347Zf6UAlbDYEvDB.FFRpG6gBHDmr7G5wkQ43ZXFa3I.lDpNkCk.+ZdtWQVzdEBCB0pJI0JHLMG51ATaVBnJx7TtI.lYL+hZtQH49QykLiPI8mz16O7ZkrKKlS0VOf2ogguPy7eGoCoS2cy9+8cvD3Mbusu.h7tAirH8ZEozXewIPQP7rbZBusyNs8ZAAsUNUWl68v6TKc2V.Q.BQqIVxkeJqHuauzRDbvLKUR5femnCF9yLUjVqQB0Sw189WT+dajtw6l1GWluXk7Rkg+RoeVd6ciG9eZJJZs1r0WsJNlqWqY6pC8s4nub9rq35NPCCFmVBDNCs5gz6e2Njxxa20.pjijByKS3Ex02xTl0kVInkIacUU4XcsYo1ZfUo5y2RfJFGg290QCoFpcwQgN.WBWaD1r0YH+ivF470HsbGxSu1nRxvVbnFVxZxr9fxkL1IZj.xr64lOci98pk1us+hJger+mriCUJVzeJWLYpotFzmuOC1ppBmGSMqtp0d+RgAn0txNM6dKYpvrn98OeA6eI24qGtqz8gtABCa554ai0vWnC8+MeKtM6AtmEEwYlJx1z872roWc8EPk7seSfUXZALy3d47Yig8MLNvDILIA+PtNMrSu4xDqrsxLlKCyD9K3ovXWqrSgwtkFQynLs5Cr7iH16KuWlFfSxrOanE78KfLtKJaQ.3mKrYEMCtF+CLlsT7Xf6q2mdafO6uA9bvF3ygafOOYC74oafOGcq9X+BpWL2nlkeLATDbV1JKGmyjTXJKahD82PD6Fdg
    

    To go further, you'll need to make an hexadecimal parser. Decompose R, G & B, into decimals, iterate, and parse back to HEX. It's not an easy thing, but I reckon @d-healey made one a while ago...





  • @d-healey Effectively, that was a while ago πŸ™‚



  • @ustk @d-healey Thanks guys. That’ll keep me busy for a while. A bone to gnaw on…



  • @ustk said in Change color in a loop with i-variable?:

    HiseSnippet 981.3ocsV01aaaCDlxwZnVccXEX+.H5mjSbSncRZyPZPcicxlwVREl65JZQQACEkMQjIEnnamwP9Ou+AaG0KVxqdYoFXBI.5t64N+buviJPqX7zTkF4z5UKR3Hmu1c7BoY5foTgDMZHx4abuflZ3ZbtpSWjPSS4gHGms9AqBmVMQYO+4yOkFSkLdkJD50JAi+yhYBSk1f9+jHN9bZH+UhY0PeP+QLkbfJVMG3yVtDTBkcMcB+RpEVCWjyWcVnvnziMTCOE4z7TU3hwSUeRli+0hTwUwbqPWzXHP4pOWEGZYrUKZvTQbXPYdmhfnDTUE1JuJ7ctWHBEK0WUM91LC3JOpWObZbazq6+M8HqidN0nWyb58P2wLsHwTYwxs66NRBMpHJzBpSqbrnFM2xcfBPHM6NidM+bMHrzC+mPHcvGRHsO1yCZCoF7GoZb.Uxi6hOAW54DtYfZVhRBB9OJ27ir9XQy.kZNfNWuE7uIBMS8auWuRHYsWaDOn2SOp62S1e+COFu2dXxahhHvSTD9p347Zf6UAlbDYEvDB.FFRpG6gBHDmr7G5wkQ43ZXFa3I.lDpNkCk.+ZdtWQVzdEBCB0pJI0JHLMG51ATaVBnJx7TtI.lYL+hZtQH49QykLiPI8mz16O7ZkrKKlS0VOf2ogguPy7eGoCoS2cy9+8cvD3Mbusu.h7tAirH8ZEozXewIPQP7rbZBusyNs8ZAAsUNUWl68v6TKc2V.Q.BQqIVxkeJqHuauzRDbvLKUR5femnCF9yLUjVqQB0Sw189WT+dajtw6l1GWluXk7Rkg+RoeVd6ciG9eZJJZs1r0WsJNlqWqY6pC8s4nub9rq35NPCCFmVBDNCs5gz6e2Njxxa20.pjijByKS3Ex02xTl0kVInkIacUU4XcsYo1ZfUo5y2RfJFGg290QCoFpcwQgN.WBWaD1r0YH+ivF470HsbGxSu1nRxvVbnFVxZxr9fxkL1IZj.xr64lOci98pk1us+hJger+mriCUJVzeJWLYpotFzmuOC1ppBmGSMqtp0d+RgAn0txNM6dKYpvrn98OeA6eI24qGtqz8gtABCa554ai0vWnC8+MeKtM6AtmEEwYlJx1z872roWc8EPk7seSfUXZALy3d47Yig8MLNvDILIA+PtNMrSu4xDqrsxLlKCyD9K3ovXWqrSgwtkFQynLs5Cr7iH16KuWlFfSxrOanE78KfLtKJaQ.3mKrYEMCtF+CLlsT7Xf6q2mdafO6uA9bvF3ygafOOYC74oafOGcq9X+BpWL2nlkeLATDbV1JKGmyjTXJKahD82PD6Fdg

    Beautiful! A circular gradient!





  • The days of bit fiddling for color manipulation are over:

    https://docs.hise.audio/scripting/scripting-api/colours/index.html



  • @Christoph-Hart Awesome. I was just trying to get away from vectors (art of code - trauma 🀣) for a bit, and now you bring the devil into our midst! Awesome! πŸ™


Log in to reply
 

9
Online

1.6k
Users

4.6k
Topics

42.5k
Posts