code: def __init__(self):
      app.Canvas.__init__(self, keys="interactive", size=(800, 800))
      ps = self.pixel_scale
  
      self.title = "D'oh! A big donut"
  
      # Create vertices
      n, p = 50, 40
      data = np.zeros(
          p * n,
          [
              ("a_position", np.float32, 2),
              ("a_bg_color", np.float32, 4),
              ("a_fg_color", np.float32, 4),
              ("a_size", np.float32),
          ],
      )
      data["a_position"][:, 0] = np.resize(
          np.linspace(0, 2 * np.pi, n), p * n
      )
      data["a_position"][:, 1] = np.repeat(
          np.linspace(0, 2 * np.pi, p), n
      )
      data["a_bg_color"] = np.random.uniform(0.75, 1.00, (n * p, 4))
      data["a_bg_color"][:, 3] = 1
      data["a_fg_color"] = 0, 0, 0, 1
      # data['a_size'] = np.random.uniform(8*ps, 8*ps, n * p)
      data["a_size"] = 8.0 * ps
      u_linewidth = 1.0 * ps
      u_antialias = 1.0
  
      self.translate = 5
      self.program = gloo.Program(vert, frag)
      self.view = translate((0, 0, -self.translate))
      self.model = np.eye(4, dtype=np.float32)
      self.projection = np.eye(4, dtype=np.float32)
  
      self.program.bind(gloo.VertexBuffer(data))
      self.program["u_linewidth"] = u_linewidth
      self.program["u_antialias"] = u_antialias
      self.program["u_model"] = self.model
      self.program["u_view"] = self.view
      self.program["u_size"] = 5 / self.translate
  
      self.apply_zoom()
  
      self.theta = 0
      self.phi = 0
      self.clock = 0
      self.stop_rotation = False
  
      gloo.set_state("translucent", clear_color="white")
      self.program["u_clock"] = 0.0
  
      self._timer = app.Timer("auto", connect=self.on_timer, start=True)
  
      self.show()
  
file_path: vispy/examples/demo/gloo/donut.py
imports: import numpy
  from vispy import gloo
  from vispy import app
  from vispy.util.transforms import perspective, translate, rotate
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()