code: def __init__(self):
      app.Canvas.__init__(self, keys="interactive", size=(800, 600))
      ps = self.pixel_scale
  
      self.title = "A very fake galaxy [mouse scroll to zoom]"
  
      data = np.zeros(
          n,
          [
              ("a_position", np.float32, 3),
              ("a_size", np.float32),
              ("a_dist", np.float32),
          ],
      )
  
      for i in range(3):
          P, S, D = make_arm(p, i * 2 * np.pi / 3)
          data["a_dist"][(i + 0) * p : (i + 1) * p] = D
          data["a_position"][(i + 0) * p : (i + 1) * p] = P
          data["a_size"][(i + 0) * p : (i + 1) * p] = S * ps
  
      self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
      self.model = np.eye(4, dtype=np.float32)
      self.projection = np.eye(4, dtype=np.float32)
      self.theta, self.phi = 0, 0
  
      self.translate = 5
      self.view = translate((0, 0, -self.translate))
  
      self.program.bind(gloo.VertexBuffer(data))
      self.program["u_colormap"] = gloo.Texture2D(cmap)
      self.program["u_size"] = 5.0 / self.translate
      self.program["u_model"] = self.model
      self.program["u_view"] = self.view
  
      self.apply_zoom()
  
      gloo.set_state(
          depth_test=False,
          blend=True,
          blend_func=("src_alpha", "one"),
          clear_color="black",
      )
  
      # Start the timer upon initialization.
      self.timer = app.Timer("auto", connect=self.on_timer)
      self.timer.start()
  
      self.show()
  
file_path: vispy/examples/demo/gloo/galaxy.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()