title: Qml Canvas Animation Error
body: <p>I have this qml file implemented into one of my main window files. However, the animation isnt showing. I copied this from a textbook tutorial on canvas animations so I was confident there would be no foreseeable errors in syntax. There are no errors when I debug, but I cannot see any part of the animation. Any ideas?</p>
  
  <p>HeartBeat.qml </p>
  
  <pre><code>Canvas{
  id: canvas
  visible: true
  
  width: 600
  height: 300
  
  property int lineWidth: 2
  property var points: []
  property real arg: -Math.PI
  
  Timer{
      interval: 10
      repeat: true
      running: true
      onTriggered: {
          arg += Math.PI/180
          while(arg &gt;= Math.PI) arg -= 2*Math.PI
      }
  }
  
  onArgChanged: {
      points.push(func(arg))
      points = points.slice(-canvas.width)
      canvas.requestPaint()
  }
  
  function func(argument){
      var a=(2*Math.PI/10); var b=4*Math/5
      return Math.sin(20*argument) * (
                  Math.exp(-Math.pow(argument/a, 2)) +
                  Math.exp(-Math.pow((argument-b)/a,2)) +
                  Math.exp(-Math.pow((argument+b)/a, 2))
                  )
  }
  
  onPaint:{
      var ctx = canvas.getContext("2d")
      ctx.reset()
      ctx.clearRect(0, 0, canvas.width, canvas.height)
      var pointsToDraw = points.slice(-canvas.width)
      ctx.translate(0, canvas.height/2)
      ctx.beginPath()
      ctx.moveTo(0, -pointsToDraw[0]*canvas.height/2)
      for(var i=1; i&lt;pointsToDraw.length; i++)
          ctx.lineTo(i, -pointsToDraw[i]*canvas.height/2)
      ctx.lineWidth = canvas.lineWidth
      ctx.stroke()
  }
  }
  </code></pre>
  
  <p>Main.qml</p>
  
  <pre><code>Item{
      id: container
      x: 530
      y: 542
      width: 600
      height: 300
  HeartBeat{
      id: heartBeatMonitor
  }
  }
  </code></pre>
  
  <p>I have no problem with other canvas animations... it is just this animation.</p>