Millisecond Forums

Randomizing Animations

https://forums.millisecond.com/Topic27460.aspx

By L O - 7/15/2019

Hi,
I have a series of picture elements with 2 kinds of animations. I want to randomize between these two animations, so that each picture will randomly have either a circle animation or a path animation. I couldn't find a function that could do this, so I tried hard coding it like so:

<trial panda>
/ stimulusframes = [1=noreplace(picture.pandapath, picture.pandacircle), video.panda_audio; 200=next1]
/ inputdevice = mouse
/ validresponse = (next1)
/ beginresponsetime = 2000
/ recorddata = false
</trial>

<picture pandapath>
/ items = ("distractor23.jpg")
/ size = (900, 900) 
/ animation = path(2000, 1, 45, 50, 55, 50, 50, 50)
</picture>

<picture pandacircle>
/ items = ("distractor23.jpg")
/ size = (900, 900) 
/ animation = circle(2000, 1, 0, 600, 375, 50)
</picture>

(This is just an example of one of the pictures, but I have more). 
But when I do this, the panda_audio won't play during the trial, so there's silence when there should be (the same) audio file playing each time the trial is played, no matter if it's a path or circle animation. Any idea of how I could randomize between these two animations while also playing audio?

Thanks!

By Dave - 7/15/2019

L O - 7/15/2019
Hi,
I have a series of picture elements with 2 kinds of animations. I want to randomize between these two animations, so that each picture will randomly have either a circle animation or a path animation. I couldn't find a function that could do this, so I tried hard coding it like so:

<trial panda>
/ stimulusframes = [1=noreplace(picture.pandapath, picture.pandacircle), video.panda_audio; 200=next1]
/ inputdevice = mouse
/ validresponse = (next1)
/ beginresponsetime = 2000
/ recorddata = false
</trial>

<picture pandapath>
/ items = ("distractor23.jpg")
/ size = (900, 900) 
/ animation = path(2000, 1, 45, 50, 55, 50, 50, 50)
</picture>

<picture pandacircle>
/ items = ("distractor23.jpg")
/ size = (900, 900) 
/ animation = circle(2000, 1, 0, 600, 375, 50)
</picture>

(This is just an example of one of the pictures, but I have more). 
But when I do this, the panda_audio won't play during the trial, so there's silence when there should be (the same) audio file playing each time the trial is played, no matter if it's a path or circle animation. Any idea of how I could randomize between these two animations while also playing audio?

Thanks!


The problem is that you can't have a selection mode (here: noreplace() for the two picture elements) AND a static stimulus (here: the video) in the same frame specified in /stimulusframes. You can either

(1) use the /inserstimulusframe() function instead to achieve the equivalent result

<block exampleblock>
/ trials = [1-10 = panda]
</block>

<trial panda>
/ ontrialbegin = [
trial.panda.insertstimulusframe(list.pandaanims.nextvalue, 1);
]
/ ontrialend = [
trial.panda.resetstimulusframes();
]
/ stimulusframes = [1=video.panda_audio; 200=next1]
/ inputdevice = mouse
/ validresponse = (next1)
/ beginresponsetime = 2000
/ recorddata = false
</trial>

<list pandaanims>
/ items = (picture.pandapath, picture.pandacircle)
/ selectionmode = random
/ replace = false
/ poolsize = 10
</list>

OR

(2) you can separate things out into two adjacent frames:

<trial panda>
/ stimulusframes = [1=noreplace(picture.pandapath, picture.pandacircle); 2=video.panda_audio; 200=next1]
/ inputdevice = mouse
/ validresponse = (next1)
/ beginresponsetime = 2000
/ recorddata = false
</trial>