Are you using the Builder? If so, the Patch stimulus has an opacity field. Set the button next to it to be "set every frame" so that its value can be changed progressively, and enter an equation in the box that does what you want.
e.g. if your screen refresh rate is 60 Hz, then entering:
frameN/120
would cycle the opacity linearly from 0 to 1.0 over 2s (it will then continue incrementing but it doesn't seem to matter if the value exceeds 1.0).
Using a code component might allow you to do more sophisticated things (e.g. fade in for a while, hold it, then fade out). Or more simply, you just create multiple successive Patch stimulus components, each with a different equation or value in the opacity field depending on their place in the timeline.
Regards,
Michael
As soon as I understand how to draw a simple square in PsychoPy I'll update my script but for now here is my script (the script need a picture file).
> As soon as I understand how to draw a simple square in PsychoPy I'll update my script but for now here is my script (the script need a picture file).
Ahh, so you're using Coder and clearly know your way around Python. Could have answered your question in one line then… :–)
Cheers,
Michael
here's the text (will get formatted to look pretty):
https://github.com/jeremygray/psychopy/commit/ceb38a9fd4b514759dba6617a2f5716dcda2f9f2
> --
> You received this message because you are subscribed to the Google Groups "psychopy-users" group.
> To post to this group, send email to psychop...@googlegroups.com.
> To unsubscribe from this group, send email to psychopy-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/psychopy-users?hl=en.
>
Great idea, as this does come up a bit…
I'm not too familiar with the Builder, so I tend to just parrot some variation on "use frameN". But that is quite limited, as it can assume that the stimulus appears at frame 0, and is it tied to the refresh rate.
I wonder if we could collect some tricks for simple one-line animation expressions (i.e. which don't involve a code component). e.g. tracking the mouse position, or a position/colour/opacity value based on a sinusoidal function of elapsed time. I'm not sure what variable names Builder exposes that would be of use?
e.g. I see that there is globalClock.getTime(), but is there also a trial time that resets to zero each repetition, for example? A shopping list of those variables in the documentation would help people along the way. Even for frameN: does it reset each trial, or is it a global frame counter for the entire experiment?
I'll add what I can find to the documentation, but any existing suggestions very welcome.
Mike
On 20 Mar, 2012, at 09:23, Jeremy Gray wrote:
> I'll add this thread to the "recipes" section of the web documentation
> (mostly copy & paste, some editing). It would make a nice addition to
> an "Animation" recipe page (along with "scrolling text" from another
> thread).
>
> here's the text (will get formatted to look pretty):
>
> https://github.com/jeremygray/psychopy/commit/ceb38a9fd4b514759dba6617a2f5716dcda2f9f2
--
Michael R. MacAskill, PhD michael....@nzbri.org
Research Director,
New Zealand Brain Research Institute
66 Stewart St http://www.nzbri.org/macaskill
Christchurch 8011 Ph: +64 3 3786 072
NEW ZEALAND Fax: +64 3 3786 080
Ahh, so you're using Coder and clearly know your way around Python. Could have answered your question in one line then… :–)
-----------------------------------------------------
Gary Lupyan - lup...@wisc.edu
Assistant Professor of Psychology
University of Wisconsin, Madison
http://sapir.psych.wisc.edu
-----------------------------------------------------
> --
> You received this message because you are subscribed to the Google Groups
> "psychopy-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/psychopy-users/-/aE4vtmSdZpMJ.
On 19/03/2012 21:08, Michael MacAskill wrote:
>
> e.g. I see that there is globalClock.getTime(), but is there also a trial time that resets to zero each repetition, for example? A shopping list of those variables in the documentation would help people along the way. Even for frameN: does it reset each trial, or is it a global frame counter for the entire experiment?
>
> I'll add what I can find to the documentation, but any existing suggestions very welcome.
some of these did get added by Becky to
http://www.psychopy.org/builder/components/code.html
The bottom of that page includes a list of some of the common variables
that people might want to use.
But we could do with more variables described there and more recipes,
maybe as a separate page (or pages) to which the Code Component points.
Jon
--
Jonathan Peirce
Nottingham Visual Neuroscience
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
You may want to check out my psychopy tutorial / exercises:
http://sapir.psych.wisc.edu/wiki/index.php/Psych711
> some of these did get added by Becky to
> http://www.psychopy.org/builder/components/code.html
> The bottom of that page includes a list of some of the common variables that people might want to use.
Ah, that's exactly what I meant, and in retrospect the code component was the obvious place to look... But people will often want to know about these variables to make full use of the standard components, even when they don't have the need for a code component per se (and so also won't be looking there in the help documents). So perhaps the documentation for each relevant component could have an explicit link to that section, saying something like "The attributes of this stimulus can be modified in real time as a function of a number of variables, as explained here…" It might forestall a lot of common questions.
Cheers,
Regards,
Michael