Created
July 26, 2018 10:15
-
-
Save fladd/c6916bddcd56461a2313b354b0d38c06 to your computer and use it in GitHub Desktop.
Fading out a stimulus in Expyriment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import expyriment, os, pygame, time | |
from expyriment import design, control, stimuli, io | |
from expyriment.misc import constants | |
#expyriment.control.defaults.open_gl = 0 | |
control.set_develop_mode(True) | |
exp = expyriment.control.initialize() | |
stim = stimuli.TextLine("A", text_colour=[255,255,255], text_size=100) | |
stim.preload(True) | |
bgcanvas_stimlist = [] | |
for x in range(255): # prepare background stimulus with a certain transparency | |
c = stimuli.Canvas(stim.surface_size) | |
c._set_surface(c._get_surface().convert()) | |
c._get_surface().set_alpha(x) | |
if expyriment.control.defaults.open_gl: | |
c2 = stimuli.Canvas(stim.surface_size) | |
c.plot(c2) | |
c = c2 | |
c.preload(True) | |
bgcanvas_stimlist.append(c) | |
for x in range(255): | |
stim.present(update=False) | |
bgcanvas_stimlist[x].present(clear=False) # | |
exp.clock.wait(10) | |
expyriment.control.end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment