Hey all how do you use the z axis when drawing and moving a model?
I have the following:
canvas = (function () {
canvas = {
canvas: $("canvas"),
models: [{
start: [10, 10, 10],
end: [1, 10, 10],
color: "silver",
},
{
start: [30, 30, 30],
end: [10, 1, 10],
color: "silver",
},
{
start: [60, 60, 60],
end: [10, 10, 10],
color: "silver",
}],
data: {},
draw: (function () {
this.data.canvas = this.canvas[0];
if (this.data.canvas.getContext) {
this.data.ctx = this.data.canvas.getContext('2d');
$.each(this.models, (function () {
canvas.data.ctx.fillStyle = this.color;
canvas.data.ctx.fillRect(this["start"][0], this["start"][1], this["end"][0], this["end"][1]);
}));
}
})
};
canvas.draw();
return canvas;
})();
Thanks in advanced..
I know 3d can be used in the 2d canvas, here is just one for you guys: http://deanm.github.com/pre3d/
So what i am trying to do is have a model of a shop item and be able to pan and look around it in 3d.. i still don't know how to move everything but for now i am asking for how to get the z axis there.. then i will ask for how to move the canvas..
P.S: Smaller code is faster to load and read..
{Please Help me I have a deadline that ends very soon}