Sha256: 143d5cadd453158f5e76a4ef6cdc23728d3f89bc7186dc4a2efa36a7516b840b
Contents?: true
Size: 765 Bytes
Versions: 4
Compression:
Stored size: 765 Bytes
Contents
# # PrimitivePShape. # # Using a PShape to display a custom polygon. # # The PShape object attr_reader :star def setup size(640, 360, P2D) smooth() # First create the shape @star = create_shape() star.begin_shape() # You can set fill and stroke star.fill(102) star.stroke(255) star.stroke_weight(2) # Here, we are hardcoding a series of vertices star.vertex(0, -50) star.vertex(14, -20) star.vertex(47, -15) star.vertex(23, 7) star.vertex(29, 40) star.vertex(0, 25) star.vertex(-29, 40) star.vertex(-23, 7) star.vertex(-47, -15) star.vertex(-14, -20) star.end_shape(CLOSE) end def draw background(51) # We can use translate to move the PShape translate(mouseX, mouseY) # Display the shape shape(star) end
Version data entries
4 entries across 4 versions & 1 rubygems