Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
wildfirecode13
xiaoxiaole
Commits
cd469f27
Commit
cd469f27
authored
Nov 27, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
acbce1cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
6 deletions
+95
-6
index.html
egret/index.html
+1
-1
ReverseMask.ts
egret/src/ReverseMask.ts
+92
-0
TaskCenter.ts
egret/src/panels/TaskCenter/TaskCenter.ts
+2
-5
No files found.
egret/index.html
View file @
cd469f27
...
...
@@ -41,7 +41,7 @@
<body>
<div
style=
"margin: auto;width: 100%;height: 100%;"
class=
"egret-player"
data-entry-class=
"Main"
data-orientation=
"auto"
data-scale-mode=
"showAll"
data-frame-rate=
"60"
data-content-width=
"750"
data-content-height=
"1624"
data-multi-fingered=
"2"
data-show-fps=
"
fals
e"
data-show-log=
"true"
data-content-height=
"1624"
data-multi-fingered=
"2"
data-show-fps=
"
tru
e"
data-show-log=
"true"
data-show-fps-style=
"x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9"
>
</div>
...
...
egret/src/ReverseMask.ts
0 → 100644
View file @
cd469f27
import
ComponentBase
from
"../libs/new_wx/components/ComponentBase"
;
// // 用法示例:
// // 创建一个形状
// function getShape(x, y, w, h) {
// let newShape = new egret.Shape();
// newShape.graphics.beginFill(0x000000);
// newShape.graphics.drawRect(x, y, w, h); // 要镂空的大小和位置
// newShape.graphics.endFill();
// return newShape;
// }
//
// let shape = getShape(100, 100, 100, 100);
// let rMask = new ReverseMask(shape); // 创建一个ReverseMask
// this.addChild(rMask); // 加入场景
//
// // 使用缓动改变镂空位置
// // 使用缓动改变 hole 的位置或透明度,需要监听onChange设置为render函数
// egret.Tween.get(rMask.hole, {onChange: rMask.render}).to({x: 500, y: 500, alpha: 0.7}, 1000).call(() => {
// egret.Tween.get(rMask.hole, {onChange: rMask.render}).to({x: 200, y: 800, alpha: 1}, 1000).call(() => {
// rMask.setMask({x: 100, y: 100, w: 800, h: 800}); // 直接对mask进行重设
//
// let shape2 = getShape(300, 300, 150, 150);
// rMask.hole = shape2; // 直接对hole赋值进行重设
// });
// })
export
default
class
ReverseMask
extends
ComponentBase
{
private
canvasW
:
number
=
750
/
window
.
innerWidth
*
window
.
innerWidth
;
private
canvasH
:
number
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
private
_shape
:
egret
.
Sprite
;
private
__mask
:
egret
.
Shape
=
new
egret
.
Shape
();
// 外面的遮罩
private
_hole
:
egret
.
Shape
;
public
get
hole
()
{
return
this
.
_hole
;
}
public
set
hole
(
hole
:
egret
.
Shape
)
{
this
.
_hole
=
hole
;
this
.
setShape
(
this
.
rect
);
}
private
rect
:
{
x
,
y
,
w
,
h
};
constructor
(
hole
:
egret
.
Shape
,
rect
?:
{
x
,
y
,
w
,
h
})
{
super
();
this
.
_hole
=
hole
;
this
.
rect
=
rect
||
{
x
:
0
,
y
:
0
,
w
:
this
.
canvasW
,
h
:
this
.
canvasH
};
this
.
setMask
(
rect
);
}
public
render
=
()
=>
{
let
renderTex
=
new
egret
.
RenderTexture
();
renderTex
.
drawToTexture
(
this
.
_shape
);
this
[
'__shape'
]
=
new
egret
.
Bitmap
(
renderTex
);
this
.
mask
=
this
[
'__shape'
];
!
this
[
'__shape'
].
parent
&&
this
.
addChild
(
this
[
'__shape'
]);
};
public
setMask
(
rect
?:
{
x
,
y
,
w
,
h
})
{
this
.
__mask
.
graphics
.
clear
();
this
.
__mask
.
graphics
.
beginFill
(
0x000000
,
0.6
);
if
(
rect
)
{
this
.
__mask
.
graphics
.
drawRect
(
rect
.
x
,
rect
.
y
,
rect
.
w
,
rect
.
h
);
}
else
{
this
.
__mask
.
graphics
.
drawRect
(
0
,
0
,
this
.
canvasW
,
this
.
canvasH
);
}
this
.
__mask
.
graphics
.
endFill
();
this
.
addChild
(
this
.
__mask
);
this
.
setShape
(
rect
);
}
private
setShape
(
rect
?:
{
x
,
y
,
w
,
h
})
{
this
.
_shape
=
new
egret
.
Sprite
();
this
.
_shape
.
graphics
.
beginFill
(
0xffffff
);
if
(
rect
)
{
this
.
_shape
.
graphics
.
drawRect
(
rect
.
x
,
rect
.
y
,
rect
.
w
,
rect
.
h
);
}
else
{
this
.
_shape
.
graphics
.
drawRect
(
0
,
0
,
this
.
canvasW
,
this
.
canvasH
);
}
this
.
_shape
.
graphics
.
endFill
();
this
.
_hole
.
blendMode
=
egret
.
BlendMode
.
ERASE
;
this
.
_shape
.
addChild
(
this
.
_hole
);
this
.
render
();
}
}
\ No newline at end of file
egret/src/panels/TaskCenter/TaskCenter.ts
View file @
cd469f27
import
Panel
from
"../../../libs/new_wx/components/Panel"
;
import
getSkinPath
from
"../../../libs/new_wx/utils/getSkinPath"
;
import
log
=
egret
.
log
;
import
{
NetManager
}
from
"../../../libs/tw/manager/NetManager"
;
import
PanelCtrl
from
"../../../libs/new_wx/ctrls/panelCtrl"
;
import
Bitmap
=
egret
.
Bitmap
;
export
default
class
TaskCenter
extends
Panel
{
public
closeBtn
:
eui
.
Button
;
...
...
@@ -14,7 +12,7 @@ export default class TaskCenter extends Panel {
let
canvasW
=
750
/
window
.
innerWidth
*
window
.
innerWidth
;
let
canvasH
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
// console.log('canvasW:' + canvasW + '\tcanvasH:' + canvasH);
log
({
console
.
log
({
canvasW
:
canvasW
,
canvasH
:
canvasH
});
...
...
@@ -74,7 +72,6 @@ class TaskCenterItem extends eui.ItemRenderer {
this
.
taskImg
.
source
=
this
.
data
.
icon
;
this
.
title
.
text
=
this
.
data
.
taskTitle
;
this
.
remark
.
text
=
this
.
data
.
remark
;
this
.
setBtn
();
// 设置按钮
}
...
...
@@ -108,7 +105,7 @@ class TaskCenterItem extends eui.ItemRenderer {
this
.
btnLabel
.
strokeColor
=
0x1376df
;
this
.
btnGroup
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
// 跳转任务链接
window
.
location
.
assig
n
(
this
.
data
.
appIncompletelink
);
window
.
ope
n
(
this
.
data
.
appIncompletelink
);
},
this
);
}
else
{
this
.
btnImg
.
source
=
'TaskCenter_'
+
'done'
+
'Btn_png'
;
...
...
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