0

I'm new with AR Spark and I saw that you can write scripts. I'm trying to write a script in pure js and I get the error about "'canvas.getContext' undefined" on canvas.

Code snippet :

    var sceneBase = Scene.root.child('Device').child('Camera').child('Focal Distance');
    var canvas = sceneBase.child('canvas0');
    var ctx = canvas.getContext('2d');

I have looked at the documentation but couldn't find anything about it. Probably AR Spark doesn't support it but I'm just wondering.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Singh
  • 783
  • 1
  • 6
  • 24
  • You originally had `getContex' in the title, but 'getContext' in the code; I've made them self-consistent. If you are missing the final t, that might explain your problem. You might also want to explain why you think there should be a 'getContext' function given that you can't find it documented. – Jonathan Leffler Nov 24 '19 at 16:42

1 Answers1

0

That is easy, getContext() is not a member of canvas object, because you don't have a webpage.

lisichka ggg
  • 563
  • 3
  • 15