Stopping the movement of an animated GIF to measure distance.


Author
Message
NinaBergner
NinaBergner
Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)
Group: Forum Members
Posts: 10, Visits: 53
Hi all!

In my study, participants should indicate what an appropriate social distance between two people would be.
Therefore, I created an animated GIF in which two people are moving towards each other.

The question is: How is it possible to stop the movement of the GIF by pressing the spacebar (and how can I measure this then)?

Do you have any ideas on how this could work? Or other ideas on how to measure the 'distance'?

<expt Version1>
/ blocks = [1=block.Social_Distancing]
</expt>

<video Social_Distancing>
/ items = ("SD1.gif")
</video>

<trial Social_Distancing>
/ stimulusframes = [1 = Social_Distancing, spacebar]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<text spacebar>
/ items = ("Please press the Spacebar at the least appropriate social distance.")
/ position = (50%, 97%)
/ valign = bottom
</text>

<block Social_Distancing>
/ trials = [1 = Social_Distancing]
</block>

Thank you in advance!

Nina


Attachments
SD1.gif (227 views, 3.00 MB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
NinaBergner - 11/26/2020
Hi all!

In my study, participants should indicate what an appropriate social distance between two people would be.
Therefore, I created an animated GIF in which two people are moving towards each other.

The question is: How is it possible to stop the movement of the GIF by pressing the spacebar (and how can I measure this then)?

Do you have any ideas on how this could work? Or other ideas on how to measure the 'distance'?

<expt Version1>
/ blocks = [1=block.Social_Distancing]
</expt>

<video Social_Distancing>
/ items = ("SD1.gif")
</video>

<trial Social_Distancing>
/ stimulusframes = [1 = Social_Distancing, spacebar]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<text spacebar>
/ items = ("Please press the Spacebar at the least appropriate social distance.")
/ position = (50%, 97%)
/ valign = bottom
</text>

<block Social_Distancing>
/ trials = [1 = Social_Distancing]
</block>

Thank you in advance!

Nina


The GIF will stop as soon as you press the spacebar. To measure the distance, you may want to take screen captures. That'll show the position of the person at the time the trial was stopped.

<expt Version1>
/ blocks = [1=block.Social_Distancing]
</expt>

<video Social_Distancing>
/ items = ("SD1.gif")
</video>

<trial Social_Distancing>
/ screencapture = true
/ stimulusframes = [1 = Social_Distancing, spacebar]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<text spacebar>
/ items = ("Please press the Spacebar at the least appropriate social distance.")
/ position = (50%, 97%)
/ valign = bottom
</text>

<block Social_Distancing>
/ trials = [1 = Social_Distancing]
</block>

Examples:




NinaBergner
NinaBergner
Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)
Group: Forum Members
Posts: 10, Visits: 53
Thank you for the quick reply!

I now doubt whether a GIF is the best way to measure distance because over 300 participants will participate in this study (with several conditions). This would mean that I would get >1000 screen pictures, which I do not know how to compare.

Do you have any other idea how I could measure distance, or do you know an example script where someone measured distance differently?

Best,

Nina




Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
NinaBergner - 11/26/2020
Thank you for the quick reply!

I now doubt whether a GIF is the best way to measure distance because over 300 participants will participate in this study (with several conditions). This would mean that I would get >1000 screen pictures, which I do not know how to compare.

Do you have any other idea how I could measure distance, or do you know an example script where someone measured distance differently?

Best,

Nina




Well, obviously latency is a proxy, albeit a fuzzy one. You know at which speed the avatar moves since you created the GIF, so you can translate latency into a distance measurement.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Dave - 11/26/2020
NinaBergner - 11/26/2020
Thank you for the quick reply!

I now doubt whether a GIF is the best way to measure distance because over 300 participants will participate in this study (with several conditions). This would mean that I would get >1000 screen pictures, which I do not know how to compare.

Do you have any other idea how I could measure distance, or do you know an example script where someone measured distance differently?

Best,

Nina




Well, obviously latency is a proxy, albeit a fuzzy one. You know at which speed the avatar moves since you created the GIF, so you can translate latency into a distance measurement.

You may want to consider woring with the /animation attribute however. Here's a quick and dirty example. A simple square moves across the screen diagonally at an uneven rate of speed. The animation is stopped when you press the space bar, and you'll have the on-screen position the shape was in at the time of the key press logged to the data file.

<shape moving>
/ shape = rectangle
/ size = (100px, 100px)
/ animation=path(3000, 1, 25%, 25%, 30%, 30%, 50%, 50%, 70%, 70%, 75%, 75%)
</shape>

<trial exampletrial>
/ stimulusframes = [1=moving]
/ validresponse = (57)
</trial>

<block exampleblock>
/ trials = [1-4 = exampletrial]
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency
    shape.moving.xpct, shape.moving.ypct)
/ separatefiles = true
</data>
NinaBergner
NinaBergner
Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)
Group: Forum Members
Posts: 10, Visits: 53
That is really helpful. I tried to understand and implement this code for my study:


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
NinaBergner - 11/26/2020
That is really helpful. I tried to understand and implement this code for my study:


If there's supposed to be any question and code there, I'm not seeing it.
NinaBergner
NinaBergner
Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)
Group: Forum Members
Posts: 10, Visits: 53
Sorry, I had some internet problems. I have two questions about your code which I tried to use for my study.

<item Woman>
/1 = "Woman.png"
</item>

<item Scenario>
/1 = "Scenario.png"
</item>

<picture Woman>
/ items = item.Woman
/ size = (40%, 40%)
/ animation=path(5000, 4, 20, 50, 50, 70)
</picture>

<picture Scenario>
/ items = item.Scenario
/ position = (50%, 50%)
/ size = (100%, 80%)
</picture>

<trial Woman>
/ stimulusframes = [1=Woman, Scenario]
/ validresponse = (57)
</trial>

<trial Scenario>
/ stimulustimes = [1=Scenario]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<block Woman>
/ trials = [1 = Woman]
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency
  picture.Woman.xpct, picture.Woman.ypct)
/ separatefiles = true
</data>


(1) What does validresponse = (57) stand for?

(2) The output of this animation is still not clear to me. With the mentioned code, will I get in the output (data file) the on-screen position of the picture at the time of a keypress which I can use for measuring /comparing the distance, or do I have to include something else additionally in the script to get this?




Attachments
Pictures.zip (193 views, 990.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
NinaBergner - 11/26/2020
Sorry, I had some internet problems. I have two questions about your code which I tried to use for my study.

<item Woman>
/1 = "Woman.png"
</item>

<item Scenario>
/1 = "Scenario.png"
</item>

<picture Woman>
/ items = item.Woman
/ size = (40%, 40%)
/ animation=path(5000, 4, 20, 50, 50, 70)
</picture>

<picture Scenario>
/ items = item.Scenario
/ position = (50%, 50%)
/ size = (100%, 80%)
</picture>

<trial Woman>
/ stimulusframes = [1=Woman, Scenario]
/ validresponse = (57)
</trial>

<trial Scenario>
/ stimulustimes = [1=Scenario]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<block Woman>
/ trials = [1 = Woman]
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency
  picture.Woman.xpct, picture.Woman.ypct)
/ separatefiles = true
</data>


(1) What does validresponse = (57) stand for?

(2) The output of this animation is still not clear to me. With the mentioned code, will I get in the output (data file) the on-screen position of the picture at the time of a keypress which I can use for measuring /comparing the distance, or do I have to include something else additionally in the script to get this?




> (1) What does validresponse = (57) stand for?

57 is the space bar's keyboard scancode, i.e. it defines a press on the spacebar as the trial's valid response. See Tools -> Keyboard scancodes... and https://www.millisecond.com/support/docs/v6/html/language/scancodes.htm

> (2) The output of this animation is still not clear to me. With the mentioned code, will I get in the output (data file) the on-screen position of the picture at the time of a keypress which I can use for measuring /comparing the distance [....]

What exactly isn't clear to you? picture.Woman.xpct and picture.Woman.ypct are the coordinates -- x (horizontal) and y (vertical) -- of the image in percentages at the time the space bar was pressed. Calculating a distance -- be it from the avatar's starting position at 5% (x) and 20% (y) or the avatar's end position at 50% (x) and 70% (y) --  from that requires only basic trigonometry. Percentages are the correct unit if you size and position everything in percentages, as your current code does. The only other thing you should do is define a uniform canvasaspectratio so that -- relatively speaking -- the relative sizes and positions are consistent across different displays with different native aspec ratios. I.e. something like

<defaults>
/ canvasaspectratio = (4,3)
/ canvassize = (100%, 100%)
</defaults>

<item Woman>
/1 = "Woman.png"
</item>

<item Scenario>
/1 = "Scenario.png"
</item>

<picture Woman>
/ items = item.Woman
/ size = (40%, 40%)
/ animation=path(5000, 4, 20%, 50%, 50%, 70%)
</picture>

<picture Scenario>
/ items = item.Scenario
/ position = (50%, 50%)
/ size = (100%, 80%)
</picture>

<trial Woman>
/ stimulusframes = [1=Woman, Scenario]
/ validresponse = (57)
</trial>

<trial Scenario>
/ stimulustimes = [1=Scenario]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<block Woman>
/ trials = [1 = Woman]
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency
picture.Woman.xpct, picture.Woman.ypct)
/ separatefiles = true
</data>

Now, ideally, you would define a square canvas, which would make the x vs y percentages directly comparable, i.e. 32% on the x-axis is exactly the same physical distance as 32% on the y-axis, which isn't the case if your canvas is wider than it is high or vice versa.

<defaults>
/ canvasaspectratio = (1,1)
/ canvassize = (100%, 100%)
</defaults>

<item Woman>
/1 = "Woman.png"
</item>

<item Scenario>
/1 = "Scenario.png"
</item>

<picture Woman>
/ items = item.Woman
/ size = (40%, 40%)
/ animation=path(5000, 4, 20%, 50%, 50%, 70%)
</picture>

<picture Scenario>
/ items = item.Scenario
/ position = (50%, 50%)
/ size = (100%, 80%)
</picture>

<trial Woman>
/ stimulusframes = [1=Woman, Scenario]
/ validresponse = (57)
</trial>

<trial Scenario>
/ stimulustimes = [1=Scenario]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<block Woman>
/ trials = [1 = Woman]
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency
picture.Woman.xpct, picture.Woman.ypct)
/ separatefiles = true
</data>


Edited 4 Years Ago by Dave
NinaBergner
NinaBergner
Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)Associate Member (144 reputation)
Group: Forum Members
Posts: 10, Visits: 53
Thank you very much Dave! You not only answered my question but also potential upcoming questions! Amazing!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search