CraftyJS – TweenColor

Posted by
April 27th, 2013 9:44 am

So when using CraftyJS’s tweens, it doesn’t tween colors.

Tween::tween only works on numeric attributes.

color is stored as a string

So I’ve spent the past 3 hours figuring that out and how to fix colors.

Find my TweenColor component on github.

Small caveat: you must set colors completely through the new ::rgb method, you can call .rgb(r,g,b) or .rgb({r:r, g:g, b:b}).

.tweenColor is .tweenColor({r:r,g:g,b:b}, frames)

Maybe this helps someone. :)

Tags: , , ,

One Response to “CraftyJS – TweenColor”

  1. Nice component! I would have use it for my LD #28 entry “Loop Desert”, see source at Anyway I’m updating CraftyComponents site and I hope to put it online soon, follow updates watching

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]