随笔分类 -  JS

在HTML5的Canvas上绘制椭圆的几种方法
摘要:概述 html5中的Canvas并没有直接提供绘制椭圆的方法,下面是对几种绘制方法的总结。各种方法各有优缺,视情况选用。各方法的参数相同:context为Canvas的2D绘图环境对象,x为椭圆中心横坐标,y为椭圆中心纵坐标,a为椭圆横半轴长,b为椭圆纵半轴长。 参数方程法 该方法利用椭圆的参数方程来绘制椭圆//-----------用参数方程绘制椭圆---------------------//函数的参数x,y为椭圆中心;a,b分别为椭圆横半轴、//纵半轴长度,不可同时为0//该方法的缺点是,当linWidth较宽,椭圆较扁时//椭圆内部长轴端较为尖锐,不平滑,效率较低function Pa 阅读全文

posted @ 2012-09-05 15:15 djy_fn 阅读(356) 评论(0) 推荐(0)

HTML 5游戏:EaselJS创建Canvas动画
摘要:When you want to write casual games using the HTML5 Canvas element, you’ll need to find a way to handle your sprites. There are several libraries available to help you writing games such asImpactJS,CraftyJSand so on. On my side, I’ve decided to useEaselJSwhich has been used to writePiratesLoveDaisie 阅读全文

posted @ 2012-06-13 16:28 djy_fn 阅读(1306) 评论(0) 推荐(0)

EaselJS-3D
摘要:本人html5初学者,正处于学习阶段,看到比较好的例子,总是亲手自己试试,慢慢学习。最近看到叶落为重生帖子rotate 3D [初识篇]学到学到了一些知识,如何做3D旋转。本文中利用EaselJS做个一样效果。demo1下面就以一个小球来展现改变z坐标的位置对其2d界面下的x,y位置和大小的影响。 1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title></title> 4 <style> 5 html {overflow:hidden} 6 阅读全文

posted @ 2012-06-13 14:13 djy_fn 阅读(792) 评论(0) 推荐(0)

HTML5 Gaming: building the core objects & handling collisions with EaselJS
摘要:We’ve seen in the previous article how to animate our sprites using EaselJS:HTML5 Gaming: animating sprites in Canvas with EaselJSWe’re now going to see how to create some of our game objects like ennemies and our platformer hero. We will also see how to implement a simple collision mechanism betwee 阅读全文

posted @ 2012-05-25 17:17 djy_fn 阅读(391) 评论(0) 推荐(0)

导航