Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Getting a text message to move slightly (ideally in Sketchpad)

I'm a newby to OS. However, your tutorials have really helped me get going. Needless to say I'm trying to keep the coding as simple as possible. Is there an easy way to get a piece of text in Sketchpad move / animate slightly without embedding videos. I need it as it part of an experiment to see what is the best stimulus for peripheral alerts.


Thanks

Comments

  • Hi @Stroller,


    Thanks for your interest in OpenSesame and in the tutorials, and welcome to the forum! :)


    If you exclusively want to use the graphical user interface, I think you could do the following:

    • Append a nested loop-sequence structure to your trial_sequence
    • Define all possible x and y locations of the text in the new loop item. The smaller you make the steps between the subsequent positions, the smoother the animation will be. (In the example I made steps of 10 pixels, which is not very smooth)
    • Make sure you set the order of this new loop item to "sequential" instead of "random"



    I uploaded an example here:



    However, because there are limits to the number of (x,y) combinations that you manually can/want to define in the block_loop, having a little bit of inline code to determine the x and y positions gives you much more freedom and flexibility.


    If the latter is what you want, then please let us know whether you want to run your study locally (in which case we'll use Python inline scripting) or in the browser (which requires JavaScript code).


    Hope this helps!


    Cheers,


    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Hi Lotje

    Fantastic. I'll give it a try. I'm running the study locally.

    Kind Regards

    Stroller

  • Hi @Stroller , ok, great! Let us know if you want to go for the inline-script option.

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Hi @lvanderlinden . It works pretty well. However, I would be interested in seeing the inline-script option (if you have time) to see if it improves the experiment and also as a learning point for me.



    Thanks


    Stroller

  • Hi @Stroller ,


    With Python inline script, you could do the following:


    • Append a Python inline_script item to the beginning of your trial_sequence and put something like the following in its Prepare tab (see comments for further explanation):
    # Import the library numpy
    import numpy as np
    
    # Define properties of the list of x and y positions:
    # (By preceeding the variable names with the .var
    # notation, we make sure that they are recognized in the interface
    # and logged by the logger item)
    var.x_start = 0 # first x coordinate
    var.x_end = 300 # last x coordinate
    
    var.y_start = 0
    var.y_end = 300
    
    # Define the number of steps
    # The higher, the smoother, but also
    # the higher, the slower
    # (Max is the length of the lists of coordinates)
    var.n_steps = 100
    
    # Define list of x positions by using the np
    # function linspace()
    list_x_pos = list(np.linspace(var.x_start, var.x_end, var.n_steps))
    
    # List of y positions:
    list_y_pos = list(np.linspace(var.y_start, var.y_end, var.n_steps))
    
    # Reverse the lists
    # (So that we can use the pop() function in the trial sequence)
    list_x_pos = list_x_pos[::-1]
    list_y_pos = list_y_pos[::-1]
    


    • Append another inline_script item to the sequence item that is embedded in the trial_sequence (which I called "move_sequence" in the example). In the Prepare tab, define the current x and y positions like so:
    var.x_pos = list_x_pos.pop()
    var.y_pos = list_y_pos.pop()
    


    • Finally, to give the nested loop (here "move_loop") the appropriate length, you need to tweak the OpenSesame script (not to be confused with Python script) of this item a little bit. To do that: click on View script (where my cursor is in the screenshot below) and change the line setting the repeat value to the variable "n_steps" as defined in the first inline_script item, like so:
    set repeat "[n_steps]"
    



    I uploaded an example file.



    Let me know if this helps!


    Cheers,


    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Hi Lotje, Thanks for all your help. I was really strugling. I have learnt a lot from your help. It's worked perfectly

  • Thank you so much for the coffee! :)

    Did you like my answer? Feel free to Buy Me A Coffee :)

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games