Box2dWeb模拟自由落体重力效果
代码语言:html
所属分类:动画
代码描述:Box2dWeb模拟自由落体重力效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html>
<head>
<title>Box2dWeb example</title>
</head>
<body onload="init();">
<canvas id="canvas" width="600" height="400"></canvas>
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/Box2dWeb-2.1.js"></script>
<script type="text/javascript">
var world;
function init() {
var b2Vec2 = Box2D.Common.Math.b2Vec2,
b2BodyDef = Box2D.Dynamics.b2BodyDef,
b2Body = Box2D.Dynamics.b2Body,
b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
b2Fixture = Box2D.Dynamics.b2Fixture,
b2World = Box2D.Dynamics.b2World,
b2MassData = Box2D.Collision.Shapes.b2MassData,
b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
b2DebugDraw = Box2D.Dynamics.b2DebugDraw;
world = new b2World(
new b2Vec2(0, 10) //gra.........完整代码请登录后点击上方下载按钮下载查看
网友评论0