注册
登录
模型可视化
>>
FlockBehaviour
>>
返回
项目作者:
KokoDoko
项目描述 :
Programming flock behaviour in Typescript
高级语言:
TypeScript
项目主页:
项目地址:
git://github.com/KokoDoko/FlockBehaviour.git
创建时间:
2017-07-11T11:03:10Z
项目社区:
https://github.com/KokoDoko/FlockBehaviour
开源协议:
下载
Flock Behaviour
Fenton the dog runs after the mouse pointer. He runs slower when he is nearer the mouse.
The sheep run away from Fenton. Sheep run slower when Fenton is further away.
Play the demo
About the code
The speed and direction of Fenton and the sheep is calculated
using vector math
The sheep go slower when Fenton is further by using
inverse proportion
Sprites are placed using semantic DOM elements such as
<sheep>
. Use CSS to style the sprite.
Sprites are animated with
CSS transform
in a
simple game loop
.
How to run locally
Open
index.html
in localhost
How to edit
Install Typescript
npm install -g typescript
Transpile the code in watch mode by typing
tsc -w
in the terminal