查看: 911|回復: 0

使用 SVG.js 进行乒乓球比赛 Pong Game with SVG.js

[複製鏈接]

798

主題

846

帖子

2796

積分

管理員

Rank: 9Rank: 9Rank: 9

積分
2796
發表於 2022-8-29 08:40:54 | 顯示全部樓層 |閱讀模式
使用 SVG.js 进行乒乓球比赛 Pong Game with SVG.js
我们最近被介绍到SVG.js,这是一个用于操作和动画 SVG(可缩放矢量图形)的库。该库以没有依赖关系而自豪,旨在成为同类中最精简的,可以做 Snap.svg 和 Raphael 可以做的事情,但代码量只有一半。
We were recently introduced to SVG.js, a library for manipulating and animating SVG (Scalable Vector Graphics). The library boasts of having no dependencies and aims to be the leanest of its kind, doing the same things that Snap.svg and Raphael can do, but with half the amount of code.
为了突出 SVG.js 库的某些方面,它的创建者为我们提供了关于如何在其框架内制作 Pong 游戏的简洁教程。看看绘制两个不同颜色的桨的代码有多短:
To highlight some aspects of the  SVG.js library, its creators have given us a neat tutorial on how to make a Pong game within their framework. Look how short the code is for drawing two paddles with different colors:
这个版本的经典街机游戏有一些很酷的效果。
例如,球在向另一侧移动时将其颜色变为对手的颜色。
This version of the classic arcade game has some cool effects.
For example, the ball changes its color into that of the opponent while moving towards the other side.
此外,当对手未能将球击回时,会产生巨大的色彩爆炸。
您可以在这里自己尝试游戏。

在这里查看教程。
Also, there is a huge color blast when the opponent fails to hit the ball back.
You can try the game yourself here.
Check out the tutorial here.

回復

使用道具 舉報

高級模式
您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

QQ|Archiver|手機版|看守所|鲁虺繁体中文社区 -

GMT+8, 2024-3-28 22:14 , Processed in 0.133108 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回復 返回頂部 返回列表