Saving Image Location
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 4
- Joined: Thu Dec 10, 2015 12:17 pm
Saving Image Location
Hey all
I am doing an image translation and I need to save the y location in a variable to manipulate later. It's an image of a burette with graduated marks on it, for which I devised an equation to calculate the numbered mark using the y location of the image. But I don't know how to isolate that information from the location x,y. Do I need to use an array?
Please help.
-Madeline
I am doing an image translation and I need to save the y location in a variable to manipulate later. It's an image of a burette with graduated marks on it, for which I devised an equation to calculate the numbered mark using the y location of the image. But I don't know how to isolate that information from the location x,y. Do I need to use an array?
Please help.
-Madeline
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Saving Image Location
No array needed. You can just store the loc in a custom property for later retrieval:
A burette? If you don't mind my asking, what are you working on? Sounds interesting.
Code: Select all
set the uSaveLoc of img 1 to the loc of image 1
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7233
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Saving Image Location
The location of an object consists of two items, so the y will be item 2:
Code: Select all
put item 2 of the loc of <object> into tY
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 4
- Joined: Thu Dec 10, 2015 12:17 pm
Re: Saving Image Location
Thanks Jacque! That's just what I needed
Question: When doing multiple math operations... do I have to:
subtract # from var and put into var2
divide # from var2 and put into var3
? It seems so inelegant.
I'm doing a virtual titration lab for my chemistry research project (chem major with a death wish). It's a pretty cool project and I'm having fun with it. I have a task that requires 0.5 g of NaOH to be weighed, and the mass button generates a random number from 0.4 to 0.6 g (it's hard to get the exact amount; what's important is knowing exactly how much NaOH you're have). The hard part is the actual titration animation. I have multiple animations going on at once:
A small stationary burette where the water level falls with drops falling into the flask with the analyte solution- the full picture of a titration
Zoomed in animation of the burette where the water is stationary, but the numbered burette image is moved upwards- shows the instantaneous water level
And I want to have a slider to adjust the movespeed of everything by some scale- to illustrate the opening and closing of the stopcock.
Oh, and the most important part: the color change of the analyte solution... which I want to occur at a random moment of the titration so that it's not so easy and predictable. I'm going to do this with blending in a pink liquid.
I've had to do some tricky layering. I don't know how I'm going to synchronize everything...
I could definitely use some help with how to move an image incrementally with an if loop. And how to do the random time color change.
This is my first code writing project and I fear I've bitten off more than I can chew.
Question: When doing multiple math operations... do I have to:
subtract # from var and put into var2
divide # from var2 and put into var3
? It seems so inelegant.
I'm doing a virtual titration lab for my chemistry research project (chem major with a death wish). It's a pretty cool project and I'm having fun with it. I have a task that requires 0.5 g of NaOH to be weighed, and the mass button generates a random number from 0.4 to 0.6 g (it's hard to get the exact amount; what's important is knowing exactly how much NaOH you're have). The hard part is the actual titration animation. I have multiple animations going on at once:
A small stationary burette where the water level falls with drops falling into the flask with the analyte solution- the full picture of a titration
Zoomed in animation of the burette where the water is stationary, but the numbered burette image is moved upwards- shows the instantaneous water level
And I want to have a slider to adjust the movespeed of everything by some scale- to illustrate the opening and closing of the stopcock.
Oh, and the most important part: the color change of the analyte solution... which I want to occur at a random moment of the titration so that it's not so easy and predictable. I'm going to do this with blending in a pink liquid.
I've had to do some tricky layering. I don't know how I'm going to synchronize everything...
I could definitely use some help with how to move an image incrementally with an if loop. And how to do the random time color change.
This is my first code writing project and I fear I've bitten off more than I can chew.
Re: Saving Image Location
LiveCode lends itself extremely well to taking small bites one at a time and seeing how they are digested...
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
-
- VIP Livecode Opensource Backer
- Posts: 7233
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Saving Image Location
No, all the usual math symbols are available. For the most part you should be able to just write out the math normally.Question: When doing multiple math operations... do I have to:
subtract # from var and put into var2
divide # from var2 and put into var3
? It seems so inelegant.
put (5 + tVar) * tMultiplier / tDivisor into tResult
I made that up, have no idea what it does.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Saving Image Location
Hi Madeline,
1. welcome to the forum!
2. To learn more about the very basics of Livecode, I recommend to work through some, if not all of these stacks:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
1. welcome to the forum!
2. To learn more about the very basics of Livecode, I recommend to work through some, if not all of these stacks:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus