Sub animate(timeStamp As Double)
Dim cat As BANanoElement
Dim hat As BANanoElement
cat.Initialize("#cat")
hat.Initialize("#hat")
'
If (lastTime <> Null) Then
angle = angle + (timeStamp - lastTime) * 0.001
End If
lastTime = timeStamp
Dim sctop As String = (Sin(angle) * 40 + 40) & "px"
Dim scleft As String = (Cos(angle) * 200 + 230) & "px"
Dim shtop As String = (Sin(angle + cPI) * 40 + 40) & "px"
Dim shleft As String = (Cos(angle + cPI) * 200 + 230) & "px"
'
Dim cstyle As Map = CreateMap("top":sctop, "left":scleft)
cat.SetStyle(BANano.ToJson(cstyle))
'
Dim hstyle As Map = CreateMap("top":shtop, "left":shleft)
hat.SetStyle(BANano.ToJson(hstyle))
BANano.Window.RequestAnimationFrame(Me, "animate")
End Sub