In the last lesson you saw how
3d graphics gives you depth and perspective along the z-axis. Here's another cool aspect about 3d graphics: the camera.
That's right...with such graphics, you get to set the camera position, about which your 3d-scene is rendered. Just as an actual photo taken with an actual camera will look different depending
on how the camera is aimed, so too will your 3d-scene depending on where your 3d-graphics camera is aimed.
When you call scene3d(), we default the camera position to (x=0,y=0,z=100), but with the camera() function shown here, you can set the camera to any position you wish, and see how it affects your scene.
Move the mouse over a dotted box for more information.
Let's again use scene3d() and sphere() to draw some spheres,
but let's now move the camera around and see how things look in response.
First, try moving the camera up and back:
Move the camera to (0,0,500)
Now to (0,0,50)
What do you notice? Now try moving it left and right
Move the camera to (20,0,100)
Now to (-20,0,100)
Now try moving it up and down
Move the camera to (0,20,100)
Now to (0,-20,100)
Now you try. Try moving the camera around and seeing how it affects your scene.
Type your code here:
See your results here:
Show a friend, family member, or teacher what you've done!
Here is a share link to your code:
Does your code work? Want to run it on your iPhone?
Here's your code:
Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
Then click the "Use on iPhone" button that you'll see.