Hi there, I'm having some trouble with css object. I want to move an image along a bezier curve. I create the image like this:
img = new Image();
img.src = "car.png";
img.xpos=275;
img.ypos=350;
And then I try to move it along the bezier curve in canvas. In the function "loop" I draw the image continuesly. Here is the code for the bezier:
ctx = document.getElementById("can").getContext("2d");
TweenLite.ticker.addEventListener("tick",loop);
TweenMax.to(img, 4, {css:{bezier:{values:[{xpos:100, ypos:250}, {xpos:300, ypos:0}, {xpos:500, ypos:400}], autoRotate:true}}, ease:Power1.easeInOut});
But it does nothing. When I remove the css object and also autoRotate attribute it works. The working version of that line is here:
TweenMax.to(img, 4, {bezier:{values:[{xpos:100, ypos:250}, {xpos:300, ypos:0}, {xpos:500, ypos:400}]}, ease:Power1.easeInOut});
I don't know how to fix it because if I try this with an <img> element it goes well also the first way. Could you somehow tell me where I made a mistake? I need to do this with an image created during process because I draw the images in canvas. Not just like this:<img src="car.png"> Thanks