Dev
搜索

Dev

createjs 获取不到Bitmap宽度的问题
发表于2015-12-18|createjs
昨天做测试,bitmap一直获取不到宽度 废了好多时间,跟热心网友一起调试后发现 是图片加载后才能获取宽高 当然这也很合情合理 是我错了 大致是这样 示例 [pcsh lang=”js” tab_size=”4” message=”” hl_lines=”” provider=”manual”] var image = new Image(); // 新建dom img元素 image.src = './img/hy.jpg'; // 指定图片路径 image.onload = function(){ // 图片加载后才能执行其他操作 var img = new createjs.Bitmap(image); var bmW = img.getBounds().width; var bmH = img.getBounds().height; img.scaleX= w/bmW; img.scaleY= w/bmW; stage.addChild(img); ...
用easeljs不能一个对象位于两个地方
发表于2015-12-17|createjs
今天遇到一个错误 我在stage放了一个图 然后又把这个位图放到了一个container里,结果后面的就不显示 因为,一个图不可能出现在两个位置 实例化两个就好了
createjs easeljs 实现图片渐隐渐显
发表于2015-12-17|createjs
主要是使用set方法 Bitmap的set方法可以设定他的alpha属性 也可以直接修改alpha属性值
easljs 精灵集
发表于2015-12-17|createjs
示例 [pcsh lang=”js” tab_size=”4” message=”” hl_lines=”” provider=”manual”] function init(){ var stage = new createjs.Stage('gameview'); var image = new Image(); var data; var spriteSheet; image.src = './spritesheet.png'; image.onload = function(e){ var text = new createjs.Text("Hello World", "20px Arial", "#ff7700"); stage.addChild(text); data = { framerate: 30, images:[image],//图片路径 frames:{"regX...
easljs drawCircle x 和 y属性
发表于2015-12-17|createjs
两个属性是指相对圆心的位置 示例: [pcsh lang=”js” tab_size=”4” message=”” hl_lines=”” provider=”manual”] var shape = new createjs.Shape(); shape.graphics.beginFill("#000").drawCircle(0,0,100); shape.x = 0; shape.y = 0; [/pcsh]
easljs drawCircle 变椭圆的解决办法
发表于2015-12-17|createjs
很可能是设置了canvas的css样式 canvas应该通过属性width和height去设置长高,否则会出现椭圆 示例: [pcsh lang=”js” tab_size=”4” message=”” hl_lines=”” provider=”manual”] <canvas id='gameview' width="210" height="210"></canvas> [/pcsh]  
easljs Shape 类
发表于2015-12-17|createjs
使用方法: 会生成一个Graphic实例,用graphics属性可以获取他 示例: [pcsh lang=”js” tab_size=”4” message=”” hl_lines=”” provider=”manual”] var shape = new createjs.Shape(); shape.graphics.beginFill("#ff0000").drawCircle(0, 0, 50); [/pcsh]    
js 事件 默认传参
发表于2015-12-17|js
使用easljs时,要在图片完全加载后才能使用Bitmap进行初始化 用到了onload事件,发现这个事件会默认传递事件‘event’过去 不知其他事件是不是都是这样的 示例: [pcsh lang=”js” tab_size=”4” message=”” hl_lines=”” provider=”manual”] image.onload = function(e){ img = new createjs.Bitmap(e.target); stage.addChild(img); stage.update(); } [/pcsh]    
createjs easeljs 容器
发表于2015-12-16|createjs
createjs有两个‘容器’ 一个是‘stage’ 一个是‘container’ 如果东西向过多,可以放到‘container’中 刷新之后才能显示 示例:  
PHP 关闭错误提示的方法
发表于2015-12-16|php
[pcsh lang=”php” tab_size=”4” message=”” hl_lines=”” provider=”manual”] ini_set("display_errors", "Off"); error_reporting(E_ALL | E_STRICT); [/pcsh]      
1…757677…103
avatar
developer
AI相伴的开发者博客
文章
1025
标签
727
分类
35
Follow Me
公告
This is my Blog
最新文章
python开发环境多版本管理2026-08-18
opencode自定义模型2026-06-18
pdf操作2026-06-04
pdf按章节拆分到文件2026-05-03
svg转png2026-04-09
分类
  • apicloud3
  • bootstrap8
  • cmder1
  • cocos2d-js5
  • createjs17
  • day45
  • docker16
  • egret14
标签
注意要点 th 配置 判断一个 git rc.local 对象 常见问题 问题 引用传递 require_once() centos 区别 animate动画 hset命令 trim 每隔一段时间 要点 pgsql 图片 golang swoft goaccess getx 显示 微信开发 设计模式 Filter 高度可自定义 开放平台 发红包 to grep 测试代码 require() call 控制器 ioc array_column 时间复杂度
归档
  • 八月 2026 1
  • 六月 2026 2
  • 五月 2026 1
  • 四月 2026 2
  • 三月 2026 3
  • 二月 2026 5
  • 一月 2026 3
  • 十二月 2025 5
网站信息
文章数目 :
1025
最后更新时间 :
© 2025 - 2026 By developer框架 Hexo 8.1.1|主题 Butterfly 5.5.4
搜索
数据加载中