سؤال

My question might seem a bit unusual, but I trust that this could be the right place for it. I'm doing a project for my studies in which I have to give visual feedback to subjects based on their brain activity. There are two things they can do for a reward, and one of the two should pay a lot more than the other. The usual way people do this is with a bar that increases in size. However, I find this a bit uninteresting and I'd like to make it more fun (or less boring).

Something less boring would be for example a balloon slowly going up in the sky; the small reward would be a temporary boost in speed; the big reward would be an even bigger increase in speed. Unfortunately, I don't have the luxury of time to invest in programming this, thus my question to you: what would be the simplest way to implement something like this ? It can be extremely primitive. The only thing that matters is to have something that gives the impression that it moves and that is accelerates/decelerates.

PS If you're wondering about the programming language, well, the rest of my setup is done in Matlab so if you can suggest something using that I would be really happy.

Thank you

هل كانت مفيدة؟

المحلول

Here's a simple program to make an animation of a moving balloon in Matlab. I used a jpg image of a balloon from google.

im = imread('balloon.jpg'); % read in image file
im = flipdim(flipdim(im,1),2); % invert the image or it will display upside down
s = size(im);
fig = figure();
xDim = 10*s(1); % set the x dimension of the figure to 10 times the size of the image
yDim = 10*s(2); % same for y
axis([0,xDim,0,yDim])


v = 100; % the distance moved by the image each time step 
for d = 1:v:1000
    x = round(xDim/2).*ones(1,s(1));
    y = d:(d+s(2));
    image(x,y,im) 
    axis([0,xDim,0,yDim])
    set(gca,'xaxislocation','bottom','yaxislocation','left','xdir','normal','ydir','normal')
    pause(1) % pause after displaying the image
end

To make the balloon move faster, you could either increase v, or decrease the pause time. Hopefully, you can incorporate that into the rest of your program.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top