This guide shows you how to enable GitHub Pages and embed the simulation in Canvas LMS.
-
Go to your repository (should be open in your browser now): https://github.com/vladimirlopez/atwood-machine-simulation
-
Navigate to Settings:
- Click the "Settings" tab at the top of the repository
-
Find Pages Settings:
- In the left sidebar, click "Pages" (under "Code and automation")
-
Configure Source:
- Under "Build and deployment"
- Source: Select "Deploy from a branch"
- Branch: Select "main" and "/ (root)"
- Click "Save"
-
Wait for Deployment (1-2 minutes):
- Refresh the page
- You'll see a message: "Your site is live at https://vladimirlopez.github.io/atwood-machine-simulation/"
-
Test the URL:
- Visit: https://vladimirlopez.github.io/atwood-machine-simulation/
- The simulation should load
If the web interface doesn't work, you can use the GitHub API:
gh api repos/vladimirlopez/atwood-machine-simulation/pages \
--method POST \
-f source[branch]=main \
-f source[path]=/Once GitHub Pages is enabled and your URL is live, you have several options:
This method displays the simulation directly in a Canvas page.
-
Edit a Canvas Page:
- Go to your Canvas course
- Navigate to Pages → Create a new page or edit an existing one
-
Switch to HTML Editor:
- Click the "HTML Editor" link in the editor toolbar
-
Add the iFrame Code:
<h2>Interactive Atwood Machine Simulation</h2> <p>Use the controls to adjust masses and initial velocity. Click Start to begin the simulation.</p> <iframe src="https://vladimirlopez.github.io/atwood-machine-simulation/" width="100%" height="900" style="border: 1px solid #ccc; border-radius: 4px;" title="Atwood Machine Simulation"> </iframe> <p><a href="https://vladimirlopez.github.io/atwood-machine-simulation/" target="_blank">Open simulation in new window</a></p>
-
Adjust Settings:
- Increase height if needed (try 900-1000 pixels)
- The simulation is responsive and will adjust to the width
-
Save and Publish
Simpler but requires students to leave Canvas:
- Edit a Canvas Page or Module
- Add Content → External URL
- Enter:
- Name: "Atwood Machine Simulation"
- URL: https://vladimirlopez.github.io/atwood-machine-simulation/
- Check "Load in a new tab"
- Save
For deeper integration with Canvas features:
- Go to Settings → Apps
- Add App → By URL
- Configure:
- Name: "Atwood Machine"
- Consumer Key: (create one)
- Shared Secret: (create one)
- Config URL: Your LTI configuration URL
Note: This requires setting up LTI on your server, which is more complex
If you want the simulation to better fit Canvas, you can modify the CSS:
Edit styles.css and add at the top:
/* Canvas LMS optimization */
@media (max-width: 768px) {
.container {
padding: 10px;
}
.simulation-wrapper {
grid-template-columns: 1fr;
}
canvas {
max-width: 100%;
height: auto;
}
}Consider adding a note at the top of index.html for Canvas users:
<div class="canvas-notice" style="background: #f0f7ff; padding: 15px; margin-bottom: 20px; border-left: 4px solid #2fa4e7;">
<strong>📚 For Canvas Users:</strong> This simulation works best in full-screen mode.
<a href="https://vladimirlopez.github.io/atwood-machine-simulation/" target="_blank">Click here to open in a new window</a>.
</div>You can turn this into an interactive assignment:
-
Create Assignment:
- Go to Assignments → + Assignment
- Name: "Atwood Machine Lab"
- Points: 10
-
Add Instructions:
Complete the following experiments using the Atwood Machine simulation: 1. Set m₁ = 2 kg, m₂ = 3 kg, v₀ = 0 m/s - Record the acceleration and tension - Explain why the system accelerates 2. Set m₁ = 2.5 kg, m₂ = 2.5 kg, v₀ = 2 m/s - What happens to the acceleration? - Describe the motion over time 3. Set m₁ = 2 kg, m₂ = 3 kg, v₀ = -3 m/s - Describe what happens to the velocity - When does the system change direction? - Why does this happen even though acceleration is constant? Submit your answers as a PDF or text entry. -
Embed the Simulation (in the assignment description using Method 1 above)
-
Set Submission Type: "Online" → "Text Entry" or "File Upload"
Before sharing with students:
- GitHub Pages URL loads correctly
- Simulation works in the iFrame
- Controls (sliders, buttons) are responsive
- Simulation displays properly on desktop
- Simulation displays properly on mobile (if applicable)
- Students can access without authentication issues
- All equations render properly (MathJax)
- Canvas doesn't block the iFrame (check browser console)
Solution 1: Check Canvas settings
- Admin might need to whitelist
github.iodomain - Contact your Canvas admin
Solution 2: Use External URL instead (Method 2 above)
Solution: Increase iFrame height:
<iframe height="1000" ...>Solution: Add longer load time or check browser console for CDN blocks
Solution:
- Check GitHub Actions tab for build errors
- Ensure all files (HTML, CSS, JS) are in root directory
- Wait 5-10 minutes after enabling Pages
- Your Live Simulation: https://vladimirlopez.github.io/atwood-machine-simulation/
- GitHub Repository: https://github.com/vladimirlopez/atwood-machine-simulation
- Canvas Community: https://community.canvaslms.com/
- GitHub Pages Docs: https://docs.github.com/en/pages
- ✅ Enable GitHub Pages (Part 1)
- ✅ Test the live URL
- ✅ Embed in Canvas (Part 2, Method 1)
- ✅ Share with students
- 📊 Gather feedback and iterate
Good luck with your Canvas integration!