Hey! This is my first post here. Can I add an image to the encoder? Like, it should rotate when I turn it. Of course, I have read all the posts and even tried a few. Thanks to the community members here. I tried the method of CSS transition with knobs and even made sprites and strips. It was fun, but I'm stuck with the encoder. I'm not a coding person, but I can implement and learn. Once again, thank you all. @jean-emmanuel Thank you for your work.
It should work very similar to what you did with regular knobs, except there a little additional trick required because the encoder's value doesn't represent its rotation angle. You'll need to retrieve the rotation angle using the encoder's onValue
script:
// rotation angle is available as locals.angle
// normalize it and store it in a custom variable
setVar(this, 'angle', locals.angle / 360)
Then in place if the @{this}
statements in your css (I assume that's how you you made it work), write VAR{angle}
to use the normalized angle between 0 and 1.
Thank you so much, Jean! After deep research into all your comments, I implemented something this morning as you suggested It's working when I create a new image, and in the CSS, I use something like this:
background-image: url(../assets/encoder.png);
transform: rotate(#{@{variable_1}}deg);
and in the encoder's script -
var min = 0,
max = 1,
index = locals.angle || 1// load index
set("variable_1", index)
Its working, but is this correct? Sorry im not a coding guy. The comments and posts from here are helpful to me.
Thank you so much!
Great !
- variables
min
andmax
seem to be unused in your script; unless it's only an extract you could start directly withvar index =
locals.angle || 1
will replace0
with1
, you may not want that (the|| 1
part)
It's perfect now! I removed the unused values. Happy that you assisted me directly.
And your MCU emulation is great for Logic Pro X, works like a charm with few implementations and mappings in Logic Pro. I've noticed some users were unable to get the MIDI out from logic, even I struggled lot, but MCU is the solution. I will post what I was doing soon, hope it will help others too. Thank you once again Jean!