Lock Moves does not work

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Lock Moves does not work

Post by maxs » Wed Jul 30, 2014 9:29 pm

I tried moving 2 small graphic images using this code.

on mouseUp
set the lockMoves to true
move grc "Fish2" to 30,30
move grc "Fish3" to 60,60
set the lockMoves to false
end mouseUp

Each image took turns jumping to the new location instead of moving smoothly at the same time. Is there a way If you want to move more than one object simultaneously?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Lock Moves does not work

Post by Simon » Wed Jul 30, 2014 9:41 pm

Hi Max,
Add without waiting
move grc "Fish2" to 30,30 without waiting
move grc "Fish3" to 60,60 without waiting

That will work for you.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Lock Moves does not work

Post by maxs » Wed Jul 30, 2014 10:05 pm

Thanks Simon for responding to this message so quickly (without waiting).

Max

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Lock Moves does not work

Post by Simon » Wed Jul 30, 2014 10:07 pm

HA!
Your message contains 3 characters. The minimum number of characters you need to enter is 10.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock Moves does not work

Post by bogs » Thu Jul 20, 2017 4:51 am

Yah yah, I know, reviving an older thread again :lol:

However, while the pointed out without waiting method *does* work, I am curious as to why 'lockMoves' does not appear to work as listed in the dictionary, tested in Lc vers. 6.5 to 9.x dp.

In testing it, I have some 5 "bubbles" that I would like to move along 5 paths (created with the freehand tool). Here is a picture of the final result, the bubbles on the right are what I wanted the final positioning to be, and do not move (they will be removed later), the lines are the drawn paths, and of course the bubbles are in their final position -
Image
According to the dictionary, setting lockMoves to true and then moving the bubbles along the path of the lines, finally setting lockMoves to false should cause all the moves to wait, then move all at once.

Of course, this does not happen, instead each bubble shows the start and end of its journey instead? The code used is pretty generic, I just want to make sure I am using it correctly:

Code: Select all

on openStack
   // set the lockMoves to true   <- first attempt, I tried it here, bubbles move to beginning, then jump to end...
   // move the bubbles to their starting position...
   set the location of graphic "bubOne" to 113,395 
   set the location of graphic "bubTwo" to 106,391
   set the location of graphic "bubThree" to 5,395
   set the location of graphic "bubFour" to 137,394
   set the location of graphic "bubFive" to 103,390
   // this starts the move handler...
   moveBubbles
end openStack

on moveBubbles
   // set the lockMoves to true <- tried it again here, same result...
   move graphic "bubOne" to the points of graphic "mainPathOne" in 3 seconds
   move graphic "bubTwo" to the points of graphic "mainPathTwo" in 3 seconds 
   move graphic "bubThree" to the points of graphic "mainPathThree" in 3 seconds 
   move graphic "bubFour" to the points of graphic "mainPathFour" in 3 seconds 
   move graphic "bubFive" to the points of graphic "mainPathFive" in 3 seconds 
   // set the lockMoves to false   
end moveBubbles
Having failed to get lockMoves working properly, I did finally find this thread. The 'withoutWaiting' *does* work, however the "bubbles" move very jerkily, where moving them one at a time moves them close to ideally.

If anyone can explain, I'd love to hear it :)
Image

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Lock Moves does not work

Post by bn » Thu Jul 20, 2017 8:32 am

Hi Bogs,

I tried this with version 5.5, 6.7 and 9 DP8 and it worked

Code: Select all

on openStack
   moveBubbles
end openStack

on moveBubbles
   lock moves
   move graphic "g1" to the points of graphic "p1" in 3 seconds without waiting
   move graphic "g2" to the points of graphic "p2" in 3 seconds without waiting
   move graphic "g3" to the points of graphic "p3" in 3 seconds without waiting
   unlock moves
end moveBubbles
Just don't expect to move too many objects at once smoothly for complex/large graphics and paths with many points. It needs a bit fine tuning.
That said my three graphics (oval 120*120) moved along pathes with about 100 points fairly smoothly.

Kind regards

Bernd

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock Moves does not work

Post by bogs » Thu Jul 20, 2017 4:31 pm

Heya Bernd !

To see what I mean about lock moves, try that code either without the 'lock moves' or without the 'without waiting'.

If you drop 'lock/unlock moves', you'll see absolutely no difference in the behavior, because "without waiting" is actually doing the work.

If you use lockMoves, lock moves, or any other combination, the effect doesn't work as the dictionary states.

In other words, the variation of lock moves commands appear to be not working as intended, at least according to documentation in the dictionary.

I don't have a vers. of Lc before 6.0, so I don't know if it ever worked below that, but sure doesn't seem to work from 6.0 up in the community additions.

Bonus if anyone knows if it actually works in the pay for editions, maybe somehow that is the difference?

The smoothness I'm not really worried about, as you say that will take some fine tuning of the code itself :)
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Lock Moves does not work

Post by [-hh] » Thu Jul 20, 2017 8:27 pm

shiftLock happens

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock Moves does not work

Post by bogs » Thu Jul 20, 2017 10:18 pm

Heya -hh :)

Thank you for the very helpful posting you linked to, I have read it, and look forward to using it to refine what I know to work currently, but for the question at hand would you know the answer?

Just to summarize -
- lockMoves, lock moves, and the unlock version of each doesn't seem to work as intended, at least not by the dictionary definition/summary/comments or examples.
- the end of the statement "without waiting" appears to actually do the work of making the movement "look" simultaneous.

Does anyone disagree with that assessment? If so, feel free to expound on what I might be missing, this really is just for learning for me, but may be important to someone else going forward.
Image

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Lock Moves does not work

Post by bn » Fri Jul 21, 2017 12:10 am

Hi Bogs,

try this code and block/unbloc "lock moves"/"unlock moves"

Code: Select all

on moveBubbles
   lock moves
   move graphic "g1" to the points of graphic "p1" in 3 seconds without waiting
   wait 1 second
   move graphic "g2" to the points of graphic "p2" in 3 seconds without waiting
   wait 1 second
   move graphic "g3" to the points of graphic "p3" in 3 seconds without waiting
   unlock moves
end moveBubbles
so lock moves does do something :)
Bonus if anyone knows if it actually works in the pay for editions, maybe somehow that is the difference?
the paid for editions have the same code base as the community editions. So what is in the community edition works just like in the paid-for ones. They do have some additional functionality but that is not a "better" version as far as the functions included in the open source version is concerned.


Kind regards
Bernd

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock Moves does not work

Post by bogs » Fri Jul 21, 2017 3:50 am

Heya Bernd !

I do want to point out that I never said it did "nothing", just that it does not appear to operate as the dictionary says it *should*.

On all of the tests I ran, it did indeed do something, just not what you might expect after reading the dictionary entry for it, and that dictionary entry is in all the editions up to current.

Btw, clever use of the wait statements, it was a test I did not run previously, and it did add an interesting element to it :)
Image

Post Reply

Return to “Multimedia”