torus()

Torus - Draws a Torus or Donut-like shape in 3D space

Example

Syntax

torus([radius], [tubeRadius], [detailX], [detailY])
Parameter
Description

radius

radius of the ring

tubeRadius

radius of the tube

chevron-rightExample Full Codehashtag
def setup():
  createCanvas(300,300, WEBGL)

def draw():
  background(255, 79, 132)
  orbitControl()
  stroke(176, 235, 51)
  fill(112, 88, 255)
  strokeWeight(2)

  r = frameCount
  rotateX(r)
  rotateY(-r)
  rotateZ(r)
  torus(75, 35)

Description

draws a torus (donut-like shape) with a specified radius of its ring and a specified radius of the circular cross section if its tube.

circle-info

Find these documents helpful? Let the people who made them help your child learn to code at Strivematharrow-up-right!

We'd love to hear your Feedback/Comments herearrow-up-right.

Last updated