cylinder()

Cylinder - draws a cylinder in 3D space

Example

Syntax

cylinder([radius], [height], [detailX], [detailY], [bottomCap], [topCap])
ParameterDescription

radius

radius of the cone

height

height of the cone

bottomCap

a boolean to specify whether or not the cylinder's bottom should be closed with a cap

topCap

a boolean to specify whether or not the cylinder's bottom should be closed with a cap

Example Full Code
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)
  cylinder(100, 150)
Example Full Code
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)
  cylinder(100, 150, 16, 16, False)ex
Example Full Code
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)
  cylinder(100, 150, 16, 16, False, False)

Description

draws a cylinder with a specified radius and height. A top or bottom cap that closes the cone is drawn by default, and can be removed by setting topCap or bottomCap to False

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.

Last updated