A fully interactive, immersive 3D virtual laboratory for performing psychology experiments focused on measuring the Span of Attention using a digital tachistoscope.
This repo now includes a productized experience with:
- persistent session history
- institution and cohort metadata
- business-facing dashboard sections
- pricing/offer positioning
- installable offline-ready PWA support
See PRODUCT_PLAYBOOK.md for a simple monetization path and launch checklist.
- Comprehensive Theory Section: Learn about attention span psychology
- Guided Instructions: Step-by-step experiment procedure
- Interactive Stimulus Presentation: Brief, timed visual stimulus display
- Real-time Feedback: Immediate response evaluation
- Detailed Analytics: Performance charts and statistics
- Learning Summary: Educational insights and viva questions
-
Configurable Parameters:
- Exposure time (0.1s to 1.0s)
- Number of trials (3-20)
- Multiple stimulus types (letters, numbers, shapes, words, mixed)
-
Stimulus Types:
- Letters (A-Z)
- Numbers (0-9)
- Shapes (▲ ● ■ ★ ◆ ▼ ○)
- Words (Common English words)
- Mixed (Combination of all types)
- Overall accuracy percentage
- Average span of attention
- Average reaction time
- Per-trial detailed statistics
- Performance trend chart
- CSV export capability
- Print-friendly results
- Realistic digital laboratory with:
- Professional experiment desk
- Digital tachistoscope device
- Participant chair
- Wall-mounted clock
- Shelves with reference books
- Advanced 3D graphics with shadows and lighting
- Smooth interactive camera
- Clean, intuitive dashboard
- Responsive design for desktop and tablet
- Professional academic appearance
- Smooth animations and transitions
- Dark mode for easy reading
- Accessibility-friendly design
- Browser: Modern web browser with WebGL support
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- RAM: Minimum 512MB
- Processor: Dual-core or better
- Display: 1024x768 or higher resolution
- Network: No internet connection required (can run locally)
-
Download/Clone the repository
git clone https://github.com/yourusername/tachistoscope.git cd Tachistoscope -
Download Required Libraries
The application requires two external libraries (Three.js and Chart.js). You can:
Option A: Using the provided setup script
bash setup.sh
Option B: Manual Download
-
Run the Application
Using Python (Python 3):
python -m http.server 8000
Then open browser to:
http://localhost:8000Using Node.js (with http-server):
npx http-server
Then open browser to:
http://localhost:8080Using PHP:
php -S localhost:8000
Then open browser to:
http://localhost:8000Direct File Opening: Simply open
index.htmlin your browser (some features may be limited)
docker build -t tachistoscope .
docker run -p 8000:8000 tachistoscope
# Open http://localhost:8000-
Welcome Screen: Read the introduction and click "Start Experiment"
-
Configuration Screen:
- Select exposure time
- Choose number of trials
- Select stimulus type
- Click "Enter Lab"
-
Lab Environment:
- Wait for the 3D lab to load
- The tachistoscope display will be visible
- Follow on-screen prompts
-
Stimulus Presentation:
- Items appear briefly on the tachistoscope screen
- Stimulus automatically disappears after the set duration
- Enter your response when the response screen appears
-
Response Input:
- Type items you observed (space-separated)
- Press Enter or click "Submit Response"
- Option to skip trial if needed
-
Results & Analysis:
- View detailed results with accuracy percentage
- See performance chart
- Access trial-by-trial breakdown
-
Learning Summary:
- Understand what the results mean
- Learn about attention span psychology
- Discuss viva questions
| Key | Action |
|---|---|
| Enter | Submit response |
| Escape | Go to welcome screen |
| F11 | Toggle fullscreen |
Tachistoscope/
├── index.html # Main HTML file
├── README.md # This file
├── setup.sh # Setup script for libraries
├── docker-compose.yml # Docker configuration (optional)
├── css/
│ ├── styles.css # Main styles
│ ├── lab.css # Lab-specific styles
│ └── ui.css # UI component styles
├── js/
│ ├── main.js # Application entry point
│ ├── data.js # Data management
│ ├── scene.js # 3D scene setup
│ ├── tachistoscope.js # Device logic
│ ├── experiment.js # Experiment flow
│ └── ui.js # UI utilities
├── lib/
│ ├── three.min.js # Three.js library (download)
│ └── chart.min.js # Chart.js library (download)
└── assets/ # For future textures/models
Manages experiment data, calculations, and storage.
Key Classes:
ExperimentData: Main data managersetConfig(): Configure experiment parametersaddTrial(): Record trial resultsgetOverallAccuracy(): Get aggregate accuracyexportResults(): Export data as JSONsaveToLocalStorage(): Persist results
Creates and manages the 3D laboratory environment using Three.js.
Key Classes:
LabScene: 3D environment managercreateLabEnvironment(): Build lab roomcreateLighting(): Set up lightingcreateTachistoscope(): Build devicecreateFurniture(): Add furniture
Controls the tachistoscope device and stimulus presentation.
Key Classes:
Tachistoscope: Device controllergenerateStimulus(): Create random stimuluspresentStimulus(): Display stimulus brieflyclearDisplay(): Clear the display
Main experiment workflow and logic.
Key Classes:
TachistoscopeExperiment: Experiment controllerstartExperiment(): Begin experimentrunTrial(): Execute single trialsubmitResponse(): Record responseshowResults(): Display results
User interface utilities and helper functions.
Key Classes:
UIManager: UI event managershowNotification(): Display messagecreateLoadingOverlay(): Show loading state
Utility Functions:
exportToCSV(): Export results as CSVprintResults(): Print resultsisMobileDevice(): Detect mobiledebounce(): Debounce function calls
- 3D Graphics: Three.js (WebGL)
- Canvas: HTML5 Canvas 2D (fallback)
- Data Visualization: Chart.js
- Styling: CSS3 with animations
- Storage: Browser localStorage
- JavaScript: ES6+ (vanilla JavaScript, no frameworks)
| Browser | Status | Notes |
|---|---|---|
| Chrome | ✅ Full | WebGL + all features |
| Firefox | ✅ Full | WebGL + all features |
| Safari | ✅ Full | WebGL + all features |
| Edge | ✅ Full | WebGL + all features |
| IE 11 | ❌ Not supported | No WebGL |
- Optimized for laptops and desktops
- Smooth 60 FPS 3D rendering
- Minimal memory footprint
- Efficient DOM updates
- Debounced event handlers
- No Server Required: Runs entirely on client-side
- No Data Transmission: Results never leave your device
- Local Storage: Results saved in browser's localStorage
- No Tracking: No analytics or tracking code
- No Cookies: No third-party cookies
Edit in js/tachistoscope.js:
this.stimulusLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
this.stimulusWords = ['CAT', 'DOG', 'SUN', ...];Edit in css/styles.css and css/ui.css:
/* Primary color */
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);Edit in js/experiment.js:
this.config = {
exposureTime: 0.3, // Default exposure time
numTrials: 10, // Default number of trials
stimulusType: 'letters'
};- Check if WebGL is enabled in your browser
- Try a different browser
- Ensure JavaScript is enabled
- Check browser console for errors (F12)
Error: "THREE is not defined"
- Download
three.min.jstolib/folder - Run
bash setup.shto auto-download
Error: "Chart is not defined"
- Download
chart.min.jstolib/folder - Run
bash setup.shto auto-download
- Check if localStorage is enabled
- Clear browser cache and reload
- Check available disk space
- Try incognito/private mode
- Ensure cursor is in input field
- Check for browser extensions interfering
- Refresh page and try again
- Try different browser
Q: Can I run this without internet? A: Yes! The application runs entirely offline. Internet is only needed to download the libraries initially.
Q: Can I modify the experiments for my research? A: Yes! The code is open source and customizable. Modify stimulus types, timing, or analysis.
Q: Where are my results saved? A: Results are saved in your browser's localStorage. They persist until you clear browser data.
Q: Can I export results? A: Yes! Results can be exported as CSV or printed from the results page.
Q: Is this accurate for actual psychology research? A: This is an educational tool. For research purposes, use validated laboratory software. However, the methodology is sound for teaching purposes.
Q: How can I add more stimulus types?
A: Edit the Tachistoscope class in js/tachistoscope.js and add new properties and generation methods.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see LICENSE file for details.
This virtual lab is designed for:
- Psychology Students: Learn about attention and perception
- Educators: Teach experimental methodology
- Researchers: Baseline for further research
- Self-Learners: Explore psychology independently
If you use this in research or publication, please cite as:
Author. (2024). 3D Psychology Virtual Lab - Span of Attention using Tachistoscope.
Retrieved from https://github.com/yourusername/tachistoscope
For issues, questions, or suggestions:
- Open an issue on GitHub
- Email: saxenamahak612@gmail.com
- Documentation: See README sections above
This is an educational tool. Results from this application should not be used for clinical or diagnostic purposes. For official psychology assessments, consult a licensed psychologist.
Version: 1.0.0
Last Updated: 2024
Status: Active Development
Enjoy learning psychology in an immersive 3D environment!