[−][src]Static p5_sys::global::cone
pub static cone: ConeInternalType
Draw a cone with given radius and height
DetailX and detailY determine the number of subdivisions in the x-dimension and the y-dimension of a cone. More subdivisions make the cone seem smoother. The recommended maximum value for detailX is 24. Using a value greater than 24 may cause a warning or slow down the browser.
Examples
// draw a spinning cone // with radius 40 and height 70 function setup() { createCanvas(100, 100, WEBGL); } function draw() { background(200); rotateX(frameCount * 0.01); rotateZ(frameCount * 0.01); cone(40, 70); }
// slide to see how detailx works let detailX; function setup() { createCanvas(100, 100, WEBGL); detailX = createSlider(3, 16, 3); detailX.position(10, height + 5); detailX.style('width', '80px'); } function draw() { background(205, 102, 94); rotateY(millis() / 1000); cone(30, 65, detailX.value(), 16); }
// slide to see how detailY works let detailY; function setup() { createCanvas(100, 100, WEBGL); detailY = createSlider(3, 16, 3); detailY.position(10, height + 5); detailY.style('width', '80px'); } function draw() { background(205, 102, 94); rotateY(millis() / 1000); cone(30, 65, 16, detailY.value()); }
Parameters
radius?
radius of the bottom surface
height?
height of the cone
detailX?
number of segments,
the more segments the smoother geometry
default is 24
detailY?
number of segments,
the more segments the smoother geometry
default is 1
cap?
whether to draw the base of the cone