一个寓教于乐的英语学习游戏,通过经典的打地鼠玩法帮助用户学习英语单词。
// 智能单词选择算法
const startNewRound = () => {
const availableWords = words.filter(
(word) => !usedWords.includes(word.english)
);
// 防重复机制:用完所有单词后重置
if (availableWords.length === 0) {
setUsedWords([]);
}
// 1个正确答案 + 5个干扰项
const allOptions = [correctWord, ...shuffledWrong].sort(
() => Math.random() - 0.5
);
};
// 双语语音播报
const speakEnglish = (text) => {
const utterance = new SpeechSynthesisUtterance(text);
utterance.lang = "en-US";
utterance.rate = 0.7;
speechSynthesis.speak(utterance);
};
const speakChinese = (text) => {
const utterance = new SpeechSynthesisUtterance(text);
utterance.lang = "zh-CN";
utterance.rate = 0.8;
speechSynthesis.speak(utterance);
};
// 地鼠弹出动画
animate(
moleElement,
{
scale: [0, 1.1, 1],
opacity: [0, 1],
},
{
duration: 400,
delay: index * 150,
easing: "easeOutElastic(1, .6)",
}
);
# 安装依赖
npm install
# 启动开发服务器
npm run dev
# 构建生产版本
npm run build
让学习英语变得更有趣!
通过游戏化的方式,让孩子在快乐中学习英语,在游戏中提升词汇量。这不仅仅是一个游戏,更是一个寓教于乐的学习工具。
React 英语打地鼠游戏——一个寓教于乐的英语学习游戏 - 高质量源码分享平台-免费下载各类网站源码与模板及前沿技术分享