// output claw position
const int open = (m_limits & 1) ? 0x800 : 0; // put open state on x bit 11
m_out_pos[0] = int((x + 15.0) * 50.0 + 0.5) | open;
m_out_pos[1] = int((y + 15.0) * 50.0 + 0.5);
And when the claw is engaged, it gets ored with 2048?
From the documentation:
Quote
Each component may have a bounds child element specifying its position and size (see Coordinates). If no such element is present, the bounds default to a unit square (width and height of 1.0) with the top left corner at (0,0).
A component’s position and/or size may be animated according to the element’s state by supplying multiple bounds child elements with state attributes. The state attribute of each bounds child element must be a non-negative integer. The state attributes must not be equal for any two bounds elements within a component.
If the element’s state is lower than the state value of any bounds child element, the position/size specified by the bounds child element with the lowest state value will be used. If the element’s state is higher than the state value of any bounds child element, the position/size specified by the bounds child element with the highest state value will be used. If the element’s state is between the state values of two bounds child elements, the position/size will be interpolated linearly.
I was amazed that all of this was done without using any kind of layout scripting where setting bounds is quite easy.
My cunning plan is to have an animated line display like this:
Okay, I looked at it and looked at it and I think I may understand a little better?
the mpos element has a disk that has bound coordinates that go from 0,0 to 3600,0 where the state goes from 0 to 3600 controlling the x coordinate which gives you movement in the horizontal direction.
Code
state = 0 x,y = 0, 0
state = 3600 x,y = 3600, 0
then you have that element as part of the view, connected to name="pos_x".
Inside, the animate tag is connected to name="pos_y"
There's a long horizontal bar that's moved vertically with animate pos_y. Inside the horizontal bar, I draw a small circle whose horizontal position is moved by element state pos_x. I draw 2 of these horizontal bars next to eachother. Claw open/close state is on x += 2048. So, one small circle is on screen, the other is off-screen and I draw a black rectangle over it to erase it.
Like that, it's possible to have a sprite moving in 2D without lua script. I do the same thing in: fidel_phantom.lay fidel_cphantom.lay excal_mirage.lay
When the driver was in development, I drew one dot at each 'joint' to see the whole arm movement, eg. after each step in update_clawpos(). If you do that then yes, it should be possible to draw lines between the joints with lua. Sounds like it'd be distracting.