Difference between revisions of "Move"

From Sim Innovations Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Description ==
== Description ==


  '''move(node_id,x,y)'''
'''move(node_id, x)'''
  '''move(node_id,x,y,width,height)'''
'''move(node_id, x, y)'''
  '''move(node_id, x, y, width)'''
  '''move(node_id, x, y, width, height)'''
'''move(node_id, x, y, width, height, animation_type)''' (from AM/AP 4.0)
'''move(node_id, x, y, width, height, animation_type, animation_speed)''' (from AM/AP 4.0)


'''move''' is used to move an object. This can be an image, text, switch, button, joystick, slider, dial, scroll wheel or a map.
'''move''' is used to move an object. This can be an image, text, switch, button, joystick, slider, dial, scroll wheel or a map.
Line 18: Line 22:
| 1 || '''node_id''' || ''ID'' || Node identifier. This number can be obtained by calling functions like [[img_add]] or [[txt_add]].
| 1 || '''node_id''' || ''ID'' || Node identifier. This number can be obtained by calling functions like [[img_add]] or [[txt_add]].
|-
|-
| 2 || '''x''' || ''Number'' || This is the most left point of the canvas where your object should be shown.  
| 2 || '''x''' || ''Number'' || (Optional) This is the most left point of the canvas where your object should be shown.  
|-
|-
| 3 || '''y''' || ''Number'' || This is the most top point of the canvas where your object should be shown.
| 3 || '''y''' || ''Number'' || (Optional) This is the most top point of the canvas where your object should be shown.
|-
|-
| 4 || '''width''' || ''Number'' || (Optional) The new width of the object.
| 4 || '''width''' || ''Number'' || (Optional) The new width of the object.
|-
|-
| 5 || '''height''' || ''Number'' || (Optional) The new height of the object
| 5 || '''height''' || ''Number'' || (Optional) The new height of the object
|-
| 6 || '''animation_type''' || ''String'' || (Optional) Can be 'OFF', 'LINEAR' or 'LOG'.
|-
| 7 || '''animation_speed''' || ''Float'' || (Optional) Animation speed. Between 1.0 (Fastest) and 0.0 (Slowest)
|}
|}


== Example ==
== Example (Simple) ==


<source lang="lua">
<source lang="lua">
-- Load and display text and images
-- Add an image
myimage1 = img_add_fullscreen("myimage1.png")
myimage1 = img_add_fullscreen("myimage1.png")


-- Move image1 to x,y = 100,100, width=200, height=250
-- Move image1 to x,y = 100,100, width=200, height=250
move(myimage1,100,100,200,250 )
move(myimage1, 100, 100, 200, 250 )


-- Move image1 to x=200
-- Move image1 to x=200
-- Note that using 'nil' will ignore that parameter (original value will be preserved)
-- Note that using 'nil' will ignore that parameter (last value will be preserved)
move(myimage1,200,nil,nil,nil )
move(myimage1, 200, nil, nil, nil )
 
</source>
 
== Example (Animation) ==
 
<source lang="lua">
-- Add an image
myimage1 = img_add_fullscreen("myimage1.png")
 
-- Enable animation
move(myimage1, nil, nil, nil, nil, "LOG", 0.04)
 
-- Any move done at this point will be animated
move(myimage1, 0, 0, 256, 256)


</source>
</source>

Latest revision as of 13:25, 8 July 2020

Description

move(node_id, x)
move(node_id, x, y)
move(node_id, x, y, width)
move(node_id, x, y, width, height)
move(node_id, x, y, width, height, animation_type) (from AM/AP 4.0)
move(node_id, x, y, width, height, animation_type, animation_speed) (from AM/AP 4.0)

move is used to move an object. This can be an image, text, switch, button, joystick, slider, dial, scroll wheel or a map.

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 node_id ID Node identifier. This number can be obtained by calling functions like img_add or txt_add.
2 x Number (Optional) This is the most left point of the canvas where your object should be shown.
3 y Number (Optional) This is the most top point of the canvas where your object should be shown.
4 width Number (Optional) The new width of the object.
5 height Number (Optional) The new height of the object
6 animation_type String (Optional) Can be 'OFF', 'LINEAR' or 'LOG'.
7 animation_speed Float (Optional) Animation speed. Between 1.0 (Fastest) and 0.0 (Slowest)

Example (Simple)

-- Add an image
myimage1 = img_add_fullscreen("myimage1.png")

-- Move image1 to x,y = 100,100, width=200, height=250
move(myimage1, 100, 100, 200, 250 )

-- Move image1 to x=200
-- Note that using 'nil' will ignore that parameter (last value will be preserved)
move(myimage1, 200, nil, nil, nil )

Example (Animation)

-- Add an image
myimage1 = img_add_fullscreen("myimage1.png")

-- Enable animation
move(myimage1, nil, nil, nil, nil, "LOG", 0.04)

-- Any move done at this point will be animated
move(myimage1, 0, 0, 256, 256)