Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
svge-egret
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王剑峰
svge-egret
Commits
fe3b6f64
Commit
fe3b6f64
authored
Oct 14, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
13fe46e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
1 deletion
+51
-1
SVGA.d.ts
SVGA.d.ts
+6
-0
svga.egret.min.js
build/svga.egret.min.js
+1
-1
MovieClip.js
src/Egret/MovieClip.js
+44
-0
No files found.
SVGA.d.ts
View file @
fe3b6f64
...
...
@@ -40,6 +40,12 @@ export class EgretMovieClip extends egret.DisplayObjectContainer {
* 所有帧数
*/
totalFrames
:
number
;
/**
*
* @param imagekey 要替换的图片key值
* @param imageUrl 图片路径或_png
*/
setImage
(
imagekey
:
string
,
imageUrl
:
string
):
void
/**
* 停止
*/
...
...
build/svga.egret.min.js
View file @
fe3b6f64
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/Egret/MovieClip.js
View file @
fe3b6f64
...
...
@@ -190,6 +190,27 @@ export class MovieClip extends egret.DisplayObjectContainer {
// console.log(this)
}
/**
*
* @param imagekey 对应的imagekey
* @param imageUrl 图片路径,以后考虑支持多种形式
*/
setImage
(
imagekey
,
imageUrl
)
{
if
(
!
this
.
textures
[
imagekey
])
return
let
texture
=
this
.
textures
[
imagekey
]
var
width
=
texture
.
textureWidth
;
var
height
=
texture
.
textureHeight
;
getAsset
(
imageUrl
,
function
(
tex
,
key
)
{
//替换掉this.textures[imagekey]
this
.
textures
[
imagekey
]
=
tex
;
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
{
let
child
=
this
.
children
[
i
]
//texture相等
if
(
child
.
texture
==
texture
)
child
.
texture
=
tex
}
},
this
)
}
/**
* 调用止方法将停止当前帧
* @method stop
...
...
@@ -522,3 +543,26 @@ export class MovieClip extends egret.DisplayObjectContainer {
return
true
}
}
/**
* @language zh_CN
* 解析素材
* @param source 待解析的新素材标识符
* @param compFunc 解析完成回调函数,示例:callBack(content:any,source:string):void;
* @param thisObject callBack的 this 引用
*/
function
getAsset
(
source
,
compFunc
,
thisObject
)
{
if
(
RES
.
hasRes
(
source
))
{
var
data
=
RES
.
getRes
(
source
);
if
(
data
)
{
compFunc
(
data
,
source
);
}
else
{
RES
.
getResAsync
(
source
,
compFunc
,
thisObject
);
}
}
else
{
RES
.
getResByUrl
(
source
,
compFunc
,
thisObject
,
RES
.
ResourceItem
.
TYPE_IMAGE
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment