简体中文 | English
An interactive web page that demonstrates a self-typing code animation effect. Watch as CSS and content are written in real-time before your eyes!
- Self-typing animation: CSS code types itself out character by character
- Syntax highlighting: Real-time CSS syntax highlighting during animation
- Interactive editing: Edit the CSS live and see changes immediately
- 3D flip effect: Scroll to flip between raw text and rendered markdown
- Pause/Resume: Control the animation playback
- Skip animation: Jump to the final result instantly
This project is configured with GitHub Actions for automatic deployment. Just push to the main branch to trigger deployment.
-
Fork/Clone the project to GitHub
-
Enable GitHub Pages
- Go to Settings → Pages
- Build and deployment → Source select GitHub Actions
-
Push to main branch
git push origin main
This will automatically trigger the deployment workflow.
-
Check deployment status
- Go to the Actions tab to view deployment progress
- After deployment, visit
https://your-username.github.io/self-coding-intro/
# Install dependencies and build
npm install
npm run build
# Manually push to gh-pages branch
git checkout --orphan gh-pages
git reset
# Keep necessary files
git add index.html dist/ ico/ img/ styles*.css work.txt header.html prestyles.css lib/
git commit -m "Deploy"
git push origin gh-pages --force- Node.js (v14 or higher)
- npm or yarn
# Clone the repository
git clone https://github.com/your-username/self-coding-intro.git
cd self-coding-intro
# Install dependencies
npm install
# Start development server
npm run devOpen your browser and navigate to http://localhost:4004/index-dev.html
npm run buildThe built files will be in the dist/ directory.
.
├── app.js # Main application logic
├── index.html # Production HTML
├── index-dev.html # Development HTML
├── work.txt # Content displayed in the work section
├── header.html # Header/footer template
├── prestyles.css # Base styles
├── styles0-3.css # Animated CSS styles
├── lib/ # Utility modules
│ ├── writeChar.js # Character writing animation
│ ├── replaceURLs.js # URL to link converter
│ └── getPrefix.js # Browser prefix detection
├── img/ # Images
├── ico/ # Favicons
└── package.json
- Animation Loop: The app uses
writeTo()function to progressively reveal CSS code - Syntax Highlighting:
handleChar()adds color classes to CSS tokens in real-time - Dual View: The work box contains both raw text and markdown-rendered HTML
- 3D Transform: CSS 3D transforms create the flip effect when scrolling
Edit work.txt to modify the displayed content. Supports Markdown format.
Edit styles0.css through styles3.css to customize the animated CSS.
Modify the speed variable in app.js:
const speed = isDev ? 0 : 16; // Lower is faster- JavaScript (ES6+)
- Webpack 5
- Babel
- Marked.js for Markdown parsing
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
If the deployed page shows blank, check the following:
- Ensure
dist/app.jsis built: Runnpm run buildto generate the production bundle - Check browser console: Look for JavaScript errors in the browser's developer console
- Verify file paths: Make sure
index.htmlcan access./dist/app.jscorrectly
Issue: mouse-wheel module not found
- Solution: This has been fixed by using static ES6 imports instead of dynamic
require(). Make sure you're using the latest version ofapp.js.
Issue: Event listener errors
- Solution: Added null checks for DOM elements before attaching event listeners.
- ✅ Fixed
mouse-wheeldynamic require issue - ✅ Added null checks for event listeners
- ✅ Improved CSS cross-browser compatibility
- ✅ Added loading state indicator
- ✅ Enhanced error handling
- ✅ Fixed skip animation scroll logic bug
- ✅ Updated ESLint config (replaced deprecated babel-eslint)
- ✅ Removed obsolete Opera CSS prefixes
- ✅ Added modern viewport and theme-color meta tags
- ✅ Improved link security (noopener noreferrer)
MIT License - feel free to use this for your own portfolio or projects!
Inspired by Jake Albaugh's work on self-typing code animations.
Also thanks to Samuel Reed's strml.net self-coding introduction project.