translate()
Translates the 3D coordinate system
Last updated
Translates the 3D coordinate system
Last updated
Parameter | Description |
---|---|
x | right-left translation |
y | up-down translation |
z | forward-backward translation (only in WEBGL mode) |
It shifts the origin on the coordinate system. Calling translate(50, 0, 0)
makes the point (50, 0, 0)
the new origin. To illustrate:
if one draws the point (10, 0, 0)
before the translation, it appears 10 pixels to the right of the original center.
if one draws the point (10, 0, 0)
after the translation, it appears 10 pixels to the right of the new center, which is 60 pixels from the original center.
Like other transformations in the library (rotateX(), rotateY(), rotateZ()), this effect is cumulative. That is, calling translate(10, 0, 0)
then translate(20, 0, 0)
is the same as translate(30, 0, 0)
Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!
We'd love to hear your Feedback/Comments here.