Reposition elements with javascript

Well,
sorry if this question is basic but : how can´t i to move elements using javascript?

The idea is reposition all the elements needed inside a scene using a javascript function located in the "scene event handler > scene activate > run javascript

element.setPosition(x,y) is not giving me positive results

Your comments are appreciated.

Hi Jairo,

element.setPosition(x,y) should work as expected.
For example, to move Div_2 element to the position (200, 100):

doc.getElement('Div_2').setPosition(200, 100);

Maybe your script contains other errors so it doesn’t work.

Regards

Well
i can see that the syntax is different

Saola don´t accept “document.” else “doc.”?
“getElementById” else “getElement”?

and… what other differences?

Because the manual only show a little list of the javascript syntax

Hi Jairo,

Document, scene, element are objects which Saola Animate HTML5 player creates to control the animation.
JavaScript APIs mentioned in the manual are public properties and methods to manipulate these objects.
They’re different from pure JavaScript properties and methods (such as document, getElementById) to manipulate the DOM elements.

Regards

I’ll add that’s in not really different - it’s like working with a JS Library such as jQuery. It’s still all pure JS under the hood.

Saola Animate just makes it easy for non programmers but in way that still allows to programmers to do brilliant things behind the scenes. Well worth the time learning how.

</ mack>

1 Like