如果文章对你有收获,还请不要吝啬【点赞❤️收藏⭐评论⚠】三连哦,你的鼓励将是我成长助力之一!谢谢!
声明:中国人民解放军军旗是神圣而庄严的象征,如果需要用于军事宣传资料、博物馆展示等,来了解和欣赏军旗的真实模样,请以官方为准!
先看实现效果
武警部队旗帜
扩展知识:武警部队历史?
武警部队的历史可追溯至新中国成立初期。在维护国家安全、社会稳定和人民生命财产安全方面发挥着重大作用。
建国伊始,为应对复杂的社会治安形势,开始组建相关的武装力量。随着时代的发展,其职能和任务不断调整和完善。
在不同的历史时期,武警部队都坚决贯彻党中央的决策部署,积极参与处置突发事件、反恐维稳、抢险救援等重大任务。
在改革开放后,武警部队的现代化建设加速推进,装备水平和作战能力不断提升。
如今,武警部队已成为一支强劲、高效、专业的武装力量,为国家的繁荣稳定作出了巨大贡献。
再看完整代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>中国武警部队军旗</title>
<style>
canvas {
/* 边框用于显示旗帜范围 */
/* border: 1px solid #000; */
/* 国旗边框阴影部分 */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body>
<center>
<h1>中国武警部队军旗</h1>
<canvas id="armyFlag" width="300" height="200"></canvas>
</center>
<script>
const canvas = document.getElementById('armyFlag');
const ctx = canvas.getContext('2d');
// 绘制红色背景
ctx.fillStyle = '#FF0000';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// 绘制五角星⭐️
ctx.beginPath();
const starPoints = 5; // ⚠️注意核心⭐:️5则是五个角,6则是六个角,100则是100个角,……
const angle = Math.PI / starPoints;
const height = canvas.height / 2;
const starRadius = height * 0.28;
const x = 40,
y = 40;
for (let i = 0; i < 2 * starPoints; i++) {
const r = i % 2 === 0 ? starRadius : starRadius / 2;
const a = i * angle;
ctx.lineTo(x + r * Math.sin(a), y - r * Math.cos(a));
}
ctx.closePath();
// ctx.strokeStyle = "rgba(255,0,0,0.5)";// 描边
ctx.fillStyle = '#FFD700'; // 填充颜色
ctx.fill();
// 绘制黄色“八一”字样
ctx.font = `${canvas.height / 8}px Arial`;
ctx.fillStyle = '#FFD700';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText('八一', canvas.width / 3, canvas.height / 3.8);
// 绘制绿色横条
ctx.fillStyle = '#34482C';
ctx.fillRect(0, 110, 300, 200);
// 绘制红色横条
ctx.fillStyle = '#BC161A';
ctx.fillRect(0, 130, 300, 200);
// 绘制绿色横条
ctx.fillStyle = '#34482C';
ctx.fillRect(0, 140, 300, 200);
// 绘制红色横条
ctx.fillStyle = '#BC161A';
ctx.fillRect(0, 160, 300, 200);
// 绘制绿色横条
ctx.fillStyle = '#34482C';
ctx.fillRect(0, 170, 300, 200);
// 绘制红色横条
ctx.fillStyle = '#BC161A';
ctx.fillRect(0, 190, 300, 200);
</script>
</body>
</html>
如果文章对你有收获,还请不要吝啬【点赞❤️收藏⭐评论⚠】三连哦,你的鼓励将是我成长助力之一!谢谢!
© 版权声明
文章版权归作者所有,未经允许请勿转载。
收藏了,感谢分享