Moving an image on a card
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Moving an image on a card
Is it possible to have an image or graphic on a card that the user can click on and move along a set path?
Hi Any,
There are several ways to do this. The easiest way is to use the move command, e.g.
This moves the image over a straight line. A neat trick is
which makes the image follow a path as defined by the points of a (hidden?) polygon. You need to draw the polygon first and you should make one with very many points.
You might also create a mathematical function to calculate the points and store these points in a return delimited list. Then use this list instead of the points of a polygon graphic.
Best,
Mark
There are several ways to do this. The easiest way is to use the move command, e.g.
Code: Select all
move img 1 from 10,10 to 200,200 in 5 secs with messages
Code: Select all
move img 1 to the points of graphic "Polygon" in 10 seconds
You might also create a mathematical function to calculate the points and store these points in a return delimited list. Then use this list instead of the points of a polygon graphic.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Right, just read some more docs and I realise I'm being a bit cryptic.
I've just noticed that this almost does what I want:
However, I only want to move the graphic horizontally between points 10 and 150 (for example).
I've just noticed that this almost does what I want:
Code: Select all
on mouseDown pMouseBtnNum
grab me
end mouseDown
Hi Andy,
That's simple:
Best,
Mark
That's simple:
Code: Select all
on mouseDown
put item 2 of the loc of me into myY
repeat until the mouse is up with messages
put the mouseH into myX
if myX > 9 and myX < 151 then
set the loc of me to the myX,myY
end if
wait 0 millisecs with messages
end repeat
end mouseDown
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode