Dynamically changing picture position


Author
Message
AndrewPapale
AndrewPapale
Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)
Group: Forum Members
Posts: 26, Visits: 101
Hi Inquisit Team,

I'm trying to dynamically change a picture's /hposition attribute trial by trial, but it is not working.  I've tried two approaches.  1) Defining one image and changing the /hposition programatically.  This did not alter the /hposition attribute correctly, the picture stayed at the default position.  2) Define a default image <picture defaultimage> and change the picture in the picture.defaultimage.item.1 to be a new image in a new position.  This also resulted in the image in the default position.  I know there has to be a way to do this, any help is appreciated! 

I would prefer not to define a new <trial> block with each image separately, I know that's another option.

Thanks,
Andrew

AndrewPapale
AndrewPapale
Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)
Group: Forum Members
Posts: 26, Visits: 101
AndrewPapale - 1/18/2023
Hi Inquisit Team,

I'm trying to dynamically change a picture's /hposition attribute trial by trial, but it is not working.  I've tried two approaches.  1) Defining one image and changing the /hposition programatically.  This did not alter the /hposition attribute correctly, the picture stayed at the default position.  2) Define a default image <picture defaultimage> and change the picture in the picture.defaultimage.item.1 to be a new image in a new position.  This also resulted in the image in the default position.  I know there has to be a way to do this, any help is appreciated! 

I would prefer not to define a new <trial> block with each image separately, I know that's another option.

Thanks,
Andrew

I'm going to try implementing a list, following from:
https://forums.millisecond.com/Topic16071.aspx
AndrewPapale
AndrewPapale
Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)
Group: Forum Members
Posts: 26, Visits: 101
AndrewPapale - 1/18/2023
AndrewPapale - 1/18/2023
Hi Inquisit Team,

I'm trying to dynamically change a picture's /hposition attribute trial by trial, but it is not working.  I've tried two approaches.  1) Defining one image and changing the /hposition programatically.  This did not alter the /hposition attribute correctly, the picture stayed at the default position.  2) Define a default image <picture defaultimage> and change the picture in the picture.defaultimage.item.1 to be a new image in a new position.  This also resulted in the image in the default position.  I know there has to be a way to do this, any help is appreciated! 

I would prefer not to define a new <trial> block with each image separately, I know that's another option.

Thanks,
Andrew

I'm going to try implementing a list, following from:
https://forums.millisecond.com/Topic16071.aspx

This also did not seem to work. Here's some example code of what I'm trying to do. I'm trying to change /hposition from a list in the <trial> based on an expression values.fogPos. Basically the idea is we want this fog image to move around the circle to different locations and stay there for a few trials.



<picture fog0>
/ items = ("fog0.png") //default
/ hposition = expressions.centerx + expressions.widthchange_angle0
/ vposition = expressions.centery + expressions.heightchange_angle0
/ size = (30%, 30%)
/ erase = false
</picture>

<picture fog30>
/ items = ("fog30.png") //default
/ hposition = expressions.centerx + expressions.widthchange_angle150
/ vposition = expressions.centery + expressions.heightchange_angle150
/ size = (30%, 30%)
/ erase = false
</picture>

<list fog_hpos>
/items = (
expressions.centerx + expressions.widthchange_angle0,
expressions.centerx + expressions.widthchange_angle30,
expressions.centerx + expressions.widthchange_angle60,
expressions.centerx + expressions.widthchange_angle90,
expressions.centerx + expressions.widthchange_angle120,
expressions.centerx + expressions.widthchange_angle150
)
/ selectionmode = list.fog_hpos.currentindex
/ selectionrate = always
</list>

<picture uncertainty>
/ items = ("fog0.png") //default
/ hposition = list.fog_hpos.nextvalue
/ vposition = list.fog_vpos.nextvalue
/ size = (30%, 30%)
/ erase = false
</picture>

<trial experiment_U>
/ ontrialbegin = [
    if (values.fogPos==30){
        picture.uncertainty.item.1 = "fog30.png";
        list.fog_hpos.item(6);
        list.fog_vpos.item(6);
    }
]
/ stimulustimes = [0 = uncertainty;]
</trial>


Thanks
-A
AndrewPapale
AndrewPapale
Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)
Group: Forum Members
Posts: 26, Visits: 101
AndrewPapale - 1/18/2023
AndrewPapale - 1/18/2023
AndrewPapale - 1/18/2023
Hi Inquisit Team,

I'm trying to dynamically change a picture's /hposition attribute trial by trial, but it is not working.  I've tried two approaches.  1) Defining one image and changing the /hposition programatically.  This did not alter the /hposition attribute correctly, the picture stayed at the default position.  2) Define a default image <picture defaultimage> and change the picture in the picture.defaultimage.item.1 to be a new image in a new position.  This also resulted in the image in the default position.  I know there has to be a way to do this, any help is appreciated! 

I would prefer not to define a new <trial> block with each image separately, I know that's another option.

Thanks,
Andrew

I'm going to try implementing a list, following from:
https://forums.millisecond.com/Topic16071.aspx

This also did not seem to work. Here's some example code of what I'm trying to do. I'm trying to change /hposition from a list in the <trial> based on an expression values.fogPos. Basically the idea is we want this fog image to move around the circle to different locations and stay there for a few trials.



<picture fog0>
/ items = ("fog0.png") //default
/ hposition = expressions.centerx + expressions.widthchange_angle0
/ vposition = expressions.centery + expressions.heightchange_angle0
/ size = (30%, 30%)
/ erase = false
</picture>

<picture fog30>
/ items = ("fog30.png") //default
/ hposition = expressions.centerx + expressions.widthchange_angle150
/ vposition = expressions.centery + expressions.heightchange_angle150
/ size = (30%, 30%)
/ erase = false
</picture>

<list fog_hpos>
/items = (
expressions.centerx + expressions.widthchange_angle0,
expressions.centerx + expressions.widthchange_angle30,
expressions.centerx + expressions.widthchange_angle60,
expressions.centerx + expressions.widthchange_angle90,
expressions.centerx + expressions.widthchange_angle120,
expressions.centerx + expressions.widthchange_angle150
)
/ selectionmode = list.fog_hpos.currentindex
/ selectionrate = always
</list>

<picture uncertainty>
/ items = ("fog0.png") //default
/ hposition = list.fog_hpos.nextvalue
/ vposition = list.fog_vpos.nextvalue
/ size = (30%, 30%)
/ erase = false
</picture>

<trial experiment_U>
/ ontrialbegin = [
    if (values.fogPos==30){
        picture.uncertainty.item.1 = "fog30.png";
        list.fog_hpos.item(6);
        list.fog_vpos.item(6);
    }
]
/ stimulustimes = [0 = uncertainty;]
</trial>


Thanks
-A

I got it working, dumb syntax error.  It worked the first way I tried it.  I was defining values.fogPos with 2 equal signs instead of 1.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 89K
AndrewPapale - 1/18/2023
AndrewPapale - 1/18/2023
AndrewPapale - 1/18/2023
AndrewPapale - 1/18/2023
Hi Inquisit Team,

I'm trying to dynamically change a picture's /hposition attribute trial by trial, but it is not working.  I've tried two approaches.  1) Defining one image and changing the /hposition programatically.  This did not alter the /hposition attribute correctly, the picture stayed at the default position.  2) Define a default image <picture defaultimage> and change the picture in the picture.defaultimage.item.1 to be a new image in a new position.  This also resulted in the image in the default position.  I know there has to be a way to do this, any help is appreciated! 

I would prefer not to define a new <trial> block with each image separately, I know that's another option.

Thanks,
Andrew

I'm going to try implementing a list, following from:
https://forums.millisecond.com/Topic16071.aspx

This also did not seem to work. Here's some example code of what I'm trying to do. I'm trying to change /hposition from a list in the <trial> based on an expression values.fogPos. Basically the idea is we want this fog image to move around the circle to different locations and stay there for a few trials.



<picture fog0>
/ items = ("fog0.png") //default
/ hposition = expressions.centerx + expressions.widthchange_angle0
/ vposition = expressions.centery + expressions.heightchange_angle0
/ size = (30%, 30%)
/ erase = false
</picture>

<picture fog30>
/ items = ("fog30.png") //default
/ hposition = expressions.centerx + expressions.widthchange_angle150
/ vposition = expressions.centery + expressions.heightchange_angle150
/ size = (30%, 30%)
/ erase = false
</picture>

<list fog_hpos>
/items = (
expressions.centerx + expressions.widthchange_angle0,
expressions.centerx + expressions.widthchange_angle30,
expressions.centerx + expressions.widthchange_angle60,
expressions.centerx + expressions.widthchange_angle90,
expressions.centerx + expressions.widthchange_angle120,
expressions.centerx + expressions.widthchange_angle150
)
/ selectionmode = list.fog_hpos.currentindex
/ selectionrate = always
</list>

<picture uncertainty>
/ items = ("fog0.png") //default
/ hposition = list.fog_hpos.nextvalue
/ vposition = list.fog_vpos.nextvalue
/ size = (30%, 30%)
/ erase = false
</picture>

<trial experiment_U>
/ ontrialbegin = [
    if (values.fogPos==30){
        picture.uncertainty.item.1 = "fog30.png";
        list.fog_hpos.item(6);
        list.fog_vpos.item(6);
    }
]
/ stimulustimes = [0 = uncertainty;]
</trial>


Thanks
-A

I got it working, dumb syntax error.  It worked the first way I tried it.  I was defining values.fogPos with 2 equal signs instead of 1.

Alright, glad to hear.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search