Millisecond Forums

Clock Task - Moving dot around clockwise in Inquisit

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

By AndrewPapale - 8/18/2022

Hello Inquisit Team:

Would it be possible to get a moving dot to go clockwise around a central stimulus in Inquisit?  The paradigm is called the clock task (https://www.jneurosci.org/content/28/47/12294).  The subject would stop the dot at a point during its motion and then receive feedback.

Thanks,
Andrew


By Dave - 8/18/2022

AndrewPapale - 8/18/2022
Hello Inquisit Team:

Would it be possible to get a moving dot to go clockwise around a central stimulus in Inquisit?  The paradigm is called the clock task (https://www.jneurosci.org/content/28/47/12294).  The subject would stop the dot at a point during its motion and then receive feedback.

Thanks,
Andrew



Sure.
By AndrewPapale - 8/18/2022

Dave - 8/18/2022
AndrewPapale - 8/18/2022
Hello Inquisit Team:

Would it be possible to get a moving dot to go clockwise around a central stimulus in Inquisit?  The paradigm is called the clock task (https://www.jneurosci.org/content/28/47/12294).  The subject would stop the dot at a point during its motion and then receive feedback.

Thanks,
Andrew



Sure.

Can you point me to some code that does simple animations, a tutorial, or another thread please?
By AndrewPapale - 8/18/2022

AndrewPapale - 8/18/2022
Dave - 8/18/2022
AndrewPapale - 8/18/2022
Hello Inquisit Team:

Would it be possible to get a moving dot to go clockwise around a central stimulus in Inquisit?  The paradigm is called the clock task (https://www.jneurosci.org/content/28/47/12294).  The subject would stop the dot at a point during its motion and then receive feedback.

Thanks,
Andrew



Sure.

Can you point me to some code that does simple animations, a tutorial, or another thread please?

I'm seeing this https://www.millisecond.com/support/docs/current/html/language/attributes/animation.htm
By Dave - 8/18/2022

AndrewPapale - 8/18/2022
Dave - 8/18/2022
AndrewPapale - 8/18/2022
Hello Inquisit Team:

Would it be possible to get a moving dot to go clockwise around a central stimulus in Inquisit?  The paradigm is called the clock task (https://www.jneurosci.org/content/28/47/12294).  The subject would stop the dot at a point during its motion and then receive feedback.

Thanks,
Andrew



Sure.

Can you point me to some code that does simple animations, a tutorial, or another thread please?

https://www.millisecond.com/download/library/pursuitrotor
https://www.millisecond.com/download/library/wundtclock
https://www.millisecond.com/download/library/mackworthclock
By Dave - 8/18/2022

Dave - 8/18/2022
AndrewPapale - 8/18/2022
Dave - 8/18/2022
AndrewPapale - 8/18/2022
Hello Inquisit Team:

Would it be possible to get a moving dot to go clockwise around a central stimulus in Inquisit?  The paradigm is called the clock task (https://www.jneurosci.org/content/28/47/12294).  The subject would stop the dot at a point during its motion and then receive feedback.

Thanks,
Andrew



Sure.

Can you point me to some code that does simple animations, a tutorial, or another thread please?

https://www.millisecond.com/download/library/pursuitrotor
https://www.millisecond.com/download/library/wundtclock
https://www.millisecond.com/download/library/mackworthclock

And here's some funky example code for a meditation type exercise using animations:

<defaults>
/ screencolor = darkblue
</defaults>

<shape mycircle1>
/ color = blue
/ shape = circle
/ animation=circle(6000, -1, 50, 50%, 50%, 35%)
/ animation=size(6000, -1, 10%, 0.1px*display.canvaswidth, 0.5, 1, 0.5)
/ erase = false
</shape>

<shape mycircle2>
/ color = blue
/ shape = circle
/ animation=circle(6000, -1, -50, 50%, 50%, 35%)
/ animation=size(6000, -1, 10%, 0.1px*display.canvaswidth, 1, 0.5, 1)
/ erase = false
</shape>

<shape mycircle3>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(6000, -1, 50, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle4>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(6000, -1, -50, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle5>
/ color = blue
/ shape = circle
/ animation=size(6000, -1, 30%, 0.30px*display.canvaswidth, 0.2, 1, 0.2)
/ erase = false
</shape>

<shape mycircle6>
/ color = darkblue
/ shape = circle
/ animation=size(6000, -1, 25%, 0.25px*display.canvaswidth, 0.2, 1, 0.2)
/ erase = false
</shape>

<text breathe>
/ items = ("focus")
/ fontstyle = ("Verdana", 10%)
/ vjustify = center
/ txcolor = blue
/ txbgcolor = transparent
/ animation=size(6000, 2, 25%, 0.25px*display.canvaswidth, 0.2, 1, 0.001)
</text>

<shape intro>
/ shape = circle
/ color = blue
/ animation = size(6500, 1, 1px*display.canvasheight, 100%, 1, 0.001)
/ erase = false
</shape>


<trial mytrial>
/ stimulusframes = [1=clearscreen, mycircle1, mycircle2, mycircle3, mycircle4, mycircle5, mycircle6, breathe, intro]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1=mytrial]
</block>

By AndrewPapale - 9/8/2022

Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]
By Dave - 9/8/2022

AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).
By Dave - 9/8/2022

Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>
By AndrewPapale - 9/8/2022

Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you
By Dave - 9/8/2022

AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

One more thing, in case it isn't obvious:

The current trial's latency is available /ontrialend, so you can absolutely perform calculations based on that latency /ontrialend in <trial experiment> -- no need to have a separate <trial> for that. To display those results on-screen, however, you would require a separate trial, it can't be done via /responsemessage or the like in the running instance of <trial experiment>.

By AndrewPapale - 9/14/2022

AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.
By AndrewPapale - 9/14/2022

AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku
By Dave - 9/14/2022

AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.

By AndrewPapale - 9/21/2022

Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?
By Dave - 9/21/2022

AndrewPapale - 9/21/2022
Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?

Generally speaking, the higher the refresh rate, the smoother animations can be. Beyond that, I'm not sure what precisely you consider to indicate "lack of smoothness" and which criteria you used to evaluate it.
By AndrewPapale - 9/21/2022

Dave - 9/21/2022
AndrewPapale - 9/21/2022
Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?

Generally speaking, the higher the refresh rate, the smoother animations can be. Beyond that, I'm not sure what precisely you consider to indicate "lack of smoothness" and which criteria you used to evaluate it.

Eh it's hard to describe without sharing a video, sorry for being imprecise.  The dot's movement around the circle can be a bit blurry / jittery.
By Dave - 9/21/2022

AndrewPapale - 9/21/2022
Dave - 9/21/2022
AndrewPapale - 9/21/2022
Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?

Generally speaking, the higher the refresh rate, the smoother animations can be. Beyond that, I'm not sure what precisely you consider to indicate "lack of smoothness" and which criteria you used to evaluate it.

Eh it's hard to describe without sharing a video, sorry for being imprecise.  The dot's movement around the circle can be a bit blurry / jittery.

I would suggest you try on the 144Hz display. In theory, that should reduce blurriness compared to running on a 60Hz display.
By AndrewPapale - 1/12/2023

AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Would it be possible to animate a custom image instead of a simple dot?  Currently using the following:

<shape animatedCircle>
/ shape = circle
/ color = darkblue
/ size = (5%, 0.05px*display.canvaswidth)
/ animation = circle(values.time_per_revolution,-1,values.startPos,50%,50%,expressions.radius_px)
/ erase = false
</shape>

By Dave - 1/12/2023

AndrewPapale - 1/12/2023
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Would it be possible to animate a custom image instead of a simple dot?  Currently using the following:

<shape animatedCircle>
/ shape = circle
/ color = darkblue
/ size = (5%, 0.05px*display.canvaswidth)
/ animation = circle(values.time_per_revolution,-1,values.startPos,50%,50%,expressions.radius_px)
/ erase = false
</shape>


Sure. The /animation attribute is available for <picture> elements and works the same way as for <shape> elements.

https://www.millisecond.com/support/docs/current/html/language/attributes/animation.htm