Implement worker to serv AVIF images

Hello, we are currently pointing “cdn.example.com” to google cloud bucket. we use polish as part of pro plan and we can see improvement in images sizes and delivery using webp. however I need help to implement worker to serv AVIF images for the same route this will improve the speed for our users. can you help please provide worker script simple code which I can implement to achieve this?
Note: I checked resize docs but I am not expert developer to write a full code. I can implement script.
Thank you.