Set Property by ID?

My goal is to change the opacity of an element on the screen, interacting other items, not the element changing. I have used this - and it works when I click on the item: hypeDocument.setElementProperty(element, ‘opacity’, .8, 1.0, ‘easeinout’)

is there a method to determine which element? is there a way to pass that as a parameter in script?

thank you!

EDIT / Solved I figured it out :slight_smile:

  hypeDocument.setElementProperty(hypeDocument.getElementById('color_changer'), 'opacity', .8, 1.0, 'easeinout')
1 Like

Correct.
Some of the API’s use element as a defualt .

If left as is this will be the element passed into the Hype function by which ever action calls the function.


function someFunc(hypeDocument, element, event) {

hypeDocument.setElementProperty( element , ‘propertyName’)

}

But you can subsitute another element as you have found.

var colorChanger = hypeDocument.getElementById("color_changer")
hypeDocument.setElementProperty(colorChanger, "opacity", 0.8, 1.0, "easeinout")
1 Like