javascript - Paper.js canvas change function triggered by button -


I am trying to update my canvas which uses paper.js via a button click. Button Do not know about my change POS () function?

  & lt; div class = "myCanvas" & gt; & Lt; Canvas ID = "canvas" width = "600" height = "600" & gt; & Lt; / Canvas & gt; & Lt; / Div & gt; & Lt; Button id = "some_button" onClick = 'changePos ();' & Gt; Change Status & lt; / Button & gt; The first script in the following script is paper.js and the second script starts the "O" text on my canvas. This is where the changePos () function is located that my brain The button should be called in when it is clicked.  
  & lt; Script src = "/ paperjs / paper.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script type = "text / papercript" canvas = "canvas" & gt; Var text = new point text ({point: visual center, justification: 'center', font size: 20, fill color: 'black'}); Function init () {text.position = view.center; text.content = "hey"; } Change function POS () {text.content = "200"; } in this(); & Lt; / Script & gt;    

You will find my answer about useful.

In order to be able to access the changePos () from the outside, you have to export it through a defined global object, e.g. Globals, or exporting, and then logging it in JavaScript.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -