Hello ,
I'd like to know how to modify the X and Y position dynamically in relation to an int tag in a group containing text and shapes.
thank you.
Hi, and welcome to the forum!
Is this for vision or perspective? The question hints at vision, but it's good to be on the same page.
Hello ,
thank you for the welcome
yes it's for Vision
This doc might be helpful for you:
2 Likes
Thank you,
but where do I write this code to animate the group?
If you want the code to update whenever a tag value is updated then I'd recommend you create a custom prop on your component (group, container, etc) then bind your tag or a timer to the property.
Then on the component use code like this on the propertyChange event handler script on the component:
# Easier for repeatability you can also have multiple properties move this component
def moveComponent(xPosition, yPosition):
DURATION = 500 # Duration is in ms, if left blank then the transform will happen straight away.
system.gui.transform(event.source, newX=xPosition, newY=yPosition, duration=DURATION)
if event.propertyName == "customPropName1":
# Get your x and y values here and assign them to a variable (can be done by reading a tag, etc).
x = 100
y = 100
moveComponent(x, y)
elif event.propertyName == "customPropName2":
# Get your x and y values here and assign them to a variable (can be done by reading a tag, etc).
x = 110
y = 110
moveComponent(x, y)
Hopefully this helps!
1 Like
Thank you,
it worked
1 Like