I have worked out how to move an image using CSS3 in 2D. However, I can not work out how to convert this to movement in 3D. I have read up on transforms however they are all about flipping and rotating. I want to move.
My 2D CSS is:
.roundBallMove {
width: 20px;
height: 20px;
position: relative;
border-radius: 10px;
-webkit-animation: roundBallMove 20s; /* Chrome, Safari, Opera */
animation: roundBallMove 20s;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes roundBallMove {
0% {background:white; left:295px; top:300px;}
50% {background:white; left:295px; top:450px;}
100% {background:white; left:10px; top:10px;}
}
/* Standard syntax */
@keyframes roundBallMove {
0% {background:white; left:295px; top:300px;}
50% {background:white; left:295px; top:450px;}
100% {background:white; left:10px; top:10px;}
}
What this shows is a ball starting with the pitcher, being pitched and then hit to left field. The hit to left field should be a fly ball (i.e., an arch in 3D trajectory).
I would really appreciate it if someone can tell me how to get this to fly in an arch (3D trajectory) instead of a straight line when hit.
Regards,
Glyn
What I have done is to create a new container to contain the image and rotated the container.
The java code is:
The CSS3 is:
This gets a movement in 3D. I have some work to do to get the ball to go exactly where I want it. Also, at the end of the animation the ball returns to where it started. I do not want this. I will post another question for this. However, if any one know how to keep the ball at the destination I would be very grateful if you could let me know. The ball starts in the lower right of the container and I want to rotate the container in x, y, z axis so the ball ends up in the top left corner.
Regards,
Glyn