Good night guys!
I am trying to make an animation where the title of my draw are constantly changing color.
I am using this function to get the color randomly
function tweenToRandomColor(ctx) {
TweenLite.to(ctx, 1, {colorProps:{fillStyle:"rgb(" + random(0,255) + "," + random(0,255) + "," + random(0,255) + ")"}, onUpdate:title, onComplete:tweenToRandomColor});
}
And here is the function that generates the random values
function random(min, max) {
return (min + Math.random() * (max - min) + 0.5) | 0;
}
Here is the functions that ai changing color
function title(){
var c = document.getElementById("acanvas").getContext("2d");
c.font="600 35px verdana";
c.fillText("SNAKES ON A PLANE",125,130);
c.fill();
}
Here my Main();
function main() {
var c2d = document.getElementById("acanvas").getContext("2d");
capa(c2d);
AllWindows(c2d);
tweenToRandomColor(c2d);
}
I put all the code in this codepen link https://codepen.io/boladeberlin/pen/eKKNOy
if someone can help me telling how to fix this "Uncaught exception: Cannot tween a null target." i will be very thankful
Have a good day :D