Mark
Mark

Reputation: 4873

How can I update an HTML 5 canvas with JavaScript?

I'm using HTML5's canvas and javascript to make an interactive pedigree tree. I am using (http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.html) as base for this project.

I'm trying to dynamically update some of the canvas elements.

I have the following javascript

function init(){
   ........
Node: {
       height: 100,
        width: 240,
        type: 'rectangle',
        overridable: true,

    },
..........

This Node property, is there a way for me to call and modify this externally?

Eg. I want to be able to change the dimensions, I would like to be able to start running this script from the Node function and changing the node shape /size.

I'm trying to avoid calling the init() function because it will reload all of the data.

Is this possible?

Upvotes: 0

Views: 145

Answers (1)

hamburger
hamburger

Reputation: 1425

If you have created a new ST instance you will get access to the Node like this:

st.Node.height = "what you want"

Upvotes: 1

Related Questions