Better Animations using Trigonometry

Note: This is a follow-up post to my post on creating psychedelic animations using trigonometry.

In my last post, I accounted for a method for creating psychedelic animations based on simple trigonometry. In this post, I’ll expand upon that method using the HSV color scheme rather than the traditional RGB color scheme.

The problem with the old method with using RGB was that each of the color channels were too easily distinguishable from each other. If you recall some of the old gifs:


Although this gif can easily be called psychedelic, it’s far too easy to distuingish the red stripes – the colors don’t blend very well, so I thought to use HSV (hue, saturation, value) to determine the colors. I’ll use the same method by having three functions H(x,y,z), S(x,y,z), V(x,y,z) but using HSV instead of RGB, my hypothesis is that this’ll create far better looking gifs.

I’m using the conversion algorithm found on the wikipedia page for HSV to convert HSV to RGB, which allows me to place the pixels on an image in Java:


In the last post, I had to manually discover fun-looking functions, however this time around, I decided to implement the random cosine waves used in my post on smooth curves and games, because I theorized that random cosine waves were better at creating fun-looking functions than myself.

The first .gif I created with this method was the following (which happens to be a perfect loop):



5 thoughts on “Better Animations using Trigonometry

  1. I think you are using HSL instead of HSV or HSI. To my eyes, HSV looks better because it doesn’t look as washed-out. I had some trouble finding formulas for HSV/HSI on wikipedia, so if you need help sorting that out just let me know.

    1. I’d love to hear it!

      How do you convert HSV/HSI to RGB? And what is the domain of the color components of HSV/HSI – are they similar to HSL?

Comment on this article

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s