Accurate timing of brief image displays with JavaScript

I am embarking on an innovative online psychology experiment using JavaScript to explore the human ability to swiftly recognize images. This study utilizes the RSVP (Rapid Serial Visual Presentation) paradigm, a prevalent method in psychophysics that isolates the feedforward, pre-attentive stages of visual processing. The goal is to display a series of images for short durations such as 30 ms, 50 ms, 70 ms, and so forth. Precision in presentation times is crucial for obtaining valid results. While traditional methods involve specialized software or equipment in a laboratory setting, I am exploring alternative options due to constraints. Although some level of error is expected when conducting this experiment in a browser, my aim is to minimize it to the greatest extent possible and assess the degree of imprecision that may occur.

Currently, the approach involves image preloading and utilizing setTimeout() to manage stimulus duration. Given that participants may be using different monitors with varying refresh rates and browsers, there are inherent challenges in maintaining consistent timing across platforms.

A visual inspection reveals inconsistencies in the timing of images with the existing methodology, suggesting significant variability. This aligns with existing literature indicating high levels of variation in brief presentation times.

Exploring potential tools to enhance timing precision in JavaScript becomes essential. Additionally, tools capable of measuring or estimating the actual screen display time of images would be invaluable. Exploring alternatives like compiling the sequence of images into a video or gif format could also offer improved control over timing aspects.

Answer №1

setTimeout simply triggers an action after a specified time has elapsed, without guaranteeing the exact timing of the event (https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout).

In scenarios like psychological experiments where external factors may affect participant behavior, it may be advisable to either block user interaction entirely while displaying content or use animated graphics for better control over the duration of exposure.

An alternative approach could involve tracking when the image enters the viewport and comparing this timestamp with participant responses, offering more reliable results by reducing reliance on the unpredictability of setTimeout.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

In TypeScript, the function is failing to retrieve the complete array value

I'm facing an issue with a program that is supposed to piece together all the letters, but it's not functioning correctly. I've tried using the debugger, but it doesn't display any errors. Here's the code snippet: var phrase = [ &a ...

When the focus() method is used to programmatically set the cursor in a JQuery input element, the blinking cursor does

I have a situation where I have two sibling divs. On the left side, I am loading a PDF document, while on the right side, I have input fields controlled by jQuery. My challenge arises when I try to select and delete the value from the input using the mous ...

Employing buffers and streams for data transmission

I am in need of a node.js program that can effectively handle a large JSON dataset with thousands of records. Specifically, I require a script that can extract only the "name" key from each record and transfer it to another file using streams. If there ar ...

Is it possible to pass multiple functions to the parent component in ReactJs if using OnChange() as a prop?

Just getting started with React and trying to pass data from a child component to a parent component. <div className="filter-module"> <i className="fas fa-sign-in-alt icon"></i> < ...

Using getElementByID with dynamically generated IDs

I need to extract data from a website for my job using a Chrome bookmarklet. Unfortunately, I don't have permission to modify the site's code. Here's an example of the type of field I want to extract: <div style="width:100%; height:10 ...

What is the best way to organize this array containing hash elements?

Similar Question: How can I sort an array of javascript objects? The data output I'm dealing with is structured like this: [ { value: 1, count: 1 }, { value: 2, count: 2 } ] My goal is to loop through the hashes in the array and return the valu ...

Transform JSON headers and rows into Object keys using Node.js

I am currently working on retrieving data from an API in JSON format using Node JS. The JSON data consists of headers and rows, including information such as "Vendor, Price, SKU, Error" (see the attached screenshot). I am looking to structure this data int ...

Creating a model with a many-to-many association using Sequelize

Technologies Stack: NodeJs, PostgreSQL, Sequelize, Express. I am working with two linked models (User and Role) through the intermediary table User_Roles. While creating a new user using Sequelize.create(), I need to populate the User_Roles table to specif ...

Improving Vue Method with Lodash?

In one of my Vue components, I have implemented logic in the watch prop that allows for sequential switching between elements when the down arrow key (key code 40) is pressed. While it is not too messy right now, there is a concern that it may become highl ...

A guide to making API calls in node.js with JSON data in the body

I am looking to send HTTP requests to an external API service. The web server I am trying to communicate with requires specific headers and a JSON payload in the request body. After researching, I found the request package which seems promising for this ...

Can the ThreeJS element be seen?

I am facing a challenge in my ThreeJS application where the view automatically centers on an object if it is close to the center of the view and closer than a specified distance. While I have information about the latitude and longitude of all objects and ...

Validation of form fields in Angular 2 using custom data attributes

Currently, I am working on implementing form validation in Angular 2 for an add product form. The form allows users to add a product to a specific store's inventory. One of the requirements is to validate that the price of the product is higher than t ...

The webpage becomes unresponsive and crashes within a matter of minutes

When my website is hosted on a server, it becomes unresponsive, freezes, and crashes after a few minutes. However, everything works fine when I run it locally on localhost while pulling API data from a Flask Server app. The Flask-based API engine retrieve ...

Is the javascript function I created not recognized as "a function"?

A small .js file containing 3 functions for easy in-site cookie management was created. Below is the source code: // Create Cookie function Bake(name,value) { var oDate = new Date(); oDate.setYear(oDate.getFullYear()+1); var oCookie = encodeURIComponent(n ...

Does the triple equal operator in JavaScript first compare the type of the value?

When using the triple equal operator, it not only measures the value but also the type. I am curious about the order in which it compares the value and returns false if they do not match, or vice versa. ...

React - Object(...) is throwing an error because it is not a function or the value it is returning cannot be

I have encountered an issue with my React hook that wraps a class component. I am attempting to pass a state from this hook to the class component using useEffect, but I keep receiving the following error: TypeError: Object(...) is not a function or its r ...

Having trouble importing a package into my React boilerplate

Having trouble importing the react-image-crop package with yarn and integrating it into a react boilerplate. Encountered an error after installing the package: Module parse failed: /Users/...../frontend/node_modules/react-image-crop/lib/ReactCrop.js Unex ...

"I'm experiencing an issue where my JSON data is not displaying in the browser when I run the code

I am having trouble displaying my json data in the browser. This is my first time working with json and I can't seem to identify the issue. I tried researching online and found that it could be related to mime types, but I still can't solve it. B ...

How can I use PHP and JavaScript to iterate through a <select> / <option> list and gather the values?

I am working on a project where I have a group of options within a selection dropdown and my goal is to utilize JavaScript to deselect all chosen values, gather them into a string, and then send it over to my PHP script. ...

How to remove an image input type using jQuery

Can anyone provide insight into the issue with these scripts? I am attempting to remove an input when it is clicked. The input is of type image, so CSS cannot be used. I have tried using JavaScript but it doesn't seem to be working. HTML <!doctyp ...