+ 2
Is it possible to change camera view with Javascript alone, not with three.js or babylon.js. Just Javascript.?
For example, if I make a 3d cube, is it possible to change the camera angle to any position around that cube with JavaScript alone?
4 Antworten
+ 2
If I understand you correctly, yes.
The following code is pure CSS:
https://code.sololearn.com/W042fu4jIrKY/#html
All those properties could be controlled by JavaScript too.
transform-style: preserve-3d should help you transform the whole cube by manipulating the transform on a single element in JavaScript.
+ 2
Josh Greig Thank you. You're saying the transform property used on the cube will give the effect of a camera rotating around the cube? Is it possible for an actual camera to rotate around the cube?
+ 2
Yes.
If all you see in 3D is a cube, there is no difference between the cube rotating and the camera rotating around the cube.
By camera, you mean the point from which you're viewing the cube, right?
On a side note, I linked to another code at https://code.sololearn.com/W042fu4jIrKY/#html because the author of the previous one cleared his code. This other one has simpler code.
+ 2
Josh Greig Yes. By camera, I mean the point from which I'm viewing the cube. Okay, so css transform can create that effect.
Thanks very much.