Ky-040 rotary encoder

Hello guys ! Newbie here , I’m trying to learn from tutorials and guides . My question is, the ky-40 that I bought, can I use it as a normal potentiometer to increase or decrease the brightness of my rgb ?? It has also a switch that I would like to use to change leds effects …
This is the part. https://www.google.com/search?q=ky-040&oq=k&aqs=chrome.0.69i59l3j69i57j69i60.982j0j9&client=ms-android-xiaomi-rev1&sourceid=chrome-mobile&ie=UTF-8

That part is a rotary encoder, NOT a potentiometer. By itself, it CANNOT replace a potentiometer. In combination with an Arduino, you may be able to control the brightness of an "rgb", whatever THAT is.

You can use an encoder library to keep track of "counts" from the encoder and apply the numbers (0 to 255) to an analog output pin to control the LED brightness.
Here's one such library:
http://www.pjrc.com/teensy/td_libs_Encoder.html