Commit eb48868f authored by wjf's avatar wjf

l

parent 23e71e8f
......@@ -10,4 +10,5 @@ webpack.config.js
/debug
/dist
rollup.config.js
record.txt
\ No newline at end of file
record.txt
test
\ No newline at end of file
......@@ -3175,8 +3175,8 @@ export class MaskManager {
/**
* Applies the Mask and adds it to the current filter stack.
*
* @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to
* @param {PIXI.Sprite} maskData - Sprite to be used as the mask
* @param {RenderTarget} target - Display Object to push the sprite mask to
* @param {Sprite} maskData - Sprite to be used as the mask
*/
private pushSpriteMask;
/**
......
This diff is collapsed.
This diff is collapsed.
{
"name": "fyge-tbmini",
"version": "1.3.2",
"version": "1.3.5",
"description": "淘宝小程序canvas渲染引擎",
"main": "./build/fyge.min.js",
"types": "./build/FYGE.d.ts",
......
......@@ -34,16 +34,21 @@
1.2.9 button的changeTexture在禁用状态时贴图也要修改
EventDispatcher添加移除指定类型的所有事件removeAllEventListenerByType
1.3.0 canvasMaskManager修改pushMask,置零globalAlpha
1.3.1 canvasMaskManager修改pushMask,置零globalAlpha
frameAni修改,frameRate不判断必执行,否则默写修改过贴图集的会不生效
frameAni新增resetTexturesAll方法
frameAni去掉changeTexture方法,直接整合进currentFrame的set方法
1.3.2 Stage的webgl模式创建webgl上下文时添加属性
1.3.3 Stage的webgl模式创建webgl上下文时添加属性
textField单行文本检测加入\r \r\n
container里removeChildren在不传参数时的修改
CanvasRenderTarget构造函数里添加clear方法,为了里面的clearRect,(淘宝canvas问题,绘制前必须调用过clearRect,否则有几率画不出来)
filterManager里恢复判断target.filterArea
maskManager里pushSpriteMask设置遮罩滤镜的范围为遮罩的bounds
1.3.5 加入lottie
loader修改兼容h5和淘宝小程序的加载json的方法
//TODO
Texture里的removeAllHandlers是否考虑加上tex.removeEventListener = function _emptyOn() { /* empty */ };
......@@ -64,4 +69,10 @@ svga的纹理考虑单独缓存在自己的数据里,不进TextureCache,movi
多page上的canvas,存在资源干扰的情况,考虑RES单独缓存,不进TextureCache缓存,createTextureSheet也不缓存进TextureCache
淘宝小程序的canvas路径api没用非零环绕原则,必须逆时针绘制想绘制的,顺时针绘制镂空的
文本在fillText没修复前,空格用\t替代
\ No newline at end of file
文本在fillText没修复前,空格用\t替代
Texture.WHITE得修改下,在canvas下不能用imageData去drawImage
h5下webgl上下丢失情况需要处理事件,待加
音频待处理,不考虑加入渲染引擎,单独搞个npm包吧,用的时候引入
\ No newline at end of file
......@@ -73,21 +73,52 @@ export class Loader extends EventDispatcher {
// // console.log(reason.message)
// })
}
/**
* 兼容
* @param callback
* @param url
*/
loadJson(callback, url) {
//@ts-ignore
my.request({
url: url,
dataType: "json",
success: (res) => {
callback(true, res.data)
},
fail: function (res) {
// my.alert({
// title: JSON.stringify(res)
// });
callback(false, res)
//@ts-ignore ,正式环境不能使用request,走downloadFile
// my.request({
// url: url,
// dataType: "json",
// success: (res) => {
// callback(true, res.data)
// },
// fail: function (res) {
// // my.alert({
// // title: JSON.stringify(res)
// // });
// callback(false, res)
// }
// });
if (my) {
this.tbLoad(callback, url, "utf8")
return
}
//每次都要new
let _req;
if (window["XMLHttpRequest"]) {
_req = new XMLHttpRequest();
} else if (window["ActiveXObject"]) {
_req = new window["ActiveXObject"]();
} else {
alert("请升级至最新版本的浏览器")
}
if (_req != null) {
_req.open("GET", url, true);
_req.responseType = "json";
_req.send();
_req.onreadystatechange = () => {
if (_req.readyState == 4 && _req.status == 200) {
callback(true, _req.response)
}
};
_req.onerror = (reason): void => {
callback(false, reason)
}
});
}
}
loadImage(callback: (s: boolean, image?: HTMLImageElement) => void, url) {
......@@ -118,7 +149,7 @@ export class Loader extends EventDispatcher {
img.src = url;
}
/**
* 加载小程序的音频
* 加载小程序的音频,暂时不用
* @param callback
* @param url
*/
......@@ -142,7 +173,76 @@ export class Loader extends EventDispatcher {
// })
}
/**
*
* @param callback
* @param url
*/
private tbLoad(
callback: (s: boolean, res?: any) => void,
url: string,
type: "utf8" | "ArrayBuffer" = "ArrayBuffer"
) {
//类似这种地址"cloud://A8673B47AAA58993A24A6718E203B967//dice.svga"
if (url.indexOf("cloud://") == 0) {
this.getTbTempUrl((src) => {
this.downloadReadFile(callback, src, type)
}, url)
} else {
this.downloadReadFile(callback, url, type)
}
}
/**
* 淘宝小程序,获取云存储临时cdn地址
* @param callback
* @param url
*/
private getTbTempUrl(callback: (src: string) => void, url) {
//@ts-ignore
const { cloud } = getApp();
//获取临时地址
cloud.file.getTempFileURL({ fileId: [url] }).then((urls) => {
callback(urls[0].url.replace('-internal', ''))
}).catch((err) => {
console.error(err)
})
}
/**
*
* @param callback
* @param url
* @param type 指定的字符编码,不传表示以 ArrayBuffer 格式读取文件的二进制内容
*/
private downloadReadFile(
callback: (s: boolean, res?: any) => void,
url: string,
type: "utf8" | "ArrayBuffer" = "ArrayBuffer"
) {
//@ts-ignore
let tbMy = my;
tbMy.downloadFile({
url: url,
success(res) {
var i = res.apFilePath;//临时地址是否有必要缓存下,如果读不到再考虑下载。
tbMy.getFileSystemManager().readFile({
filePath: i,
encoding: type,//不加表示加载的是ArrayBuffer
success: function (r) {
callback(true, r.data)//注意是r.data
// actions.load_viaProto(r.data, cb, failure);
},
fail: function (res) {
callback(false, res)
}
})
},
fail(res) {
callback(false, res)
},
});
}
private cache(name: string, data: any) {
if (this.caches[name]) {
......
......@@ -119,7 +119,7 @@ export default class FilterManager {
// for now we go off the filter of the first resolution..
const resolution = filters[0].resolution;
const padding = filters[0].padding | 0;
const targetBounds = /*fullScreen ? renderer.screen : (target.filterArea ||*/ target.getBounds(true)/*)*/;
const targetBounds = /*fullScreen ? renderer.screen : (*/target.filterArea || target.getBounds(true)/*)*/;
const sourceFrame:Rectangle = currentState.sourceFrame;
const destinationFrame = currentState.destinationFrame;
......
......@@ -94,8 +94,8 @@ export default class MaskManager {
/**
* Applies the Mask and adds it to the current filter stack.
*
* @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to
* @param {PIXI.Sprite} maskData - Sprite to be used as the mask
* @param {RenderTarget} target - Display Object to push the sprite mask to
* @param {Sprite} maskData - Sprite to be used as the mask
*/
private pushSpriteMask(target, maskData) {
let alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];
......@@ -107,10 +107,14 @@ export default class MaskManager {
alphaMaskFilter[0].resolution = 1;
alphaMaskFilter[0].maskSprite = maskData;
// TODO - may cause issues!
// target.filterArea = maskData.getBounds(true);
//存下之前的滤镜区域
const cacheFilterArea = target.filterArea;
//取遮罩的范围
target.filterArea = maskData.getBounds(true);
this.renderer.filterManager.pushFilter(target, alphaMaskFilter);
//恢复
target.filterArea = cacheFilterArea;
this.alphaMaskIndex++;
}
......
This diff is collapsed.
......@@ -4,4 +4,6 @@ export * from "./ScrollPage";
export * from "./ScrollList";
export * from "./ShowWord";
export * from "./MovieClip";
\ No newline at end of file
export * from "./MovieClip";
export * from "./Lottie";
\ No newline at end of file
const cloud_back = {
"v": "5.6.10",
"fr": 30,
"ip": 0,
"op": 120,
"w": 750,
"h": 1624,
"nm": "cloud_back",
"layers": [
{
"ind": 1,
"ty": 2,
"nm": "control",
"refId": "cloud_7",
"ks": {
"o": {
"a": 0,
"k": 1
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
997,
652,
0
]
},
{
"t": 59,
"s": [
997,
675,
0
]
},
{
"t": 120,
"s": [
997,
652,
0
]
}
]
},
"a": {
"a": 0,
"k": [
249,
110,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 450
},
{
"ind": 2,
"ty": 2,
"nm": "cloud_3.png",
"parent": 1,
"refId": "cloud_3",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": -12,
"s": [
434,
-20,
0
]
},
{
"t": 33,
"s": [
-1190,
454,
0
]
}
]
},
"a": {
"a": 0,
"k": [
446.5,
151.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": -12,
"op": 438
},
{
"ind": 3,
"ty": 2,
"nm": "cloud_2.png",
"parent": 1,
"refId": "cloud_2",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": -17,
"s": [
308,
140,
0
]
},
{
"t": 48,
"s": [
-1060,
550,
0
]
}
]
},
"a": {
"a": 0,
"k": [
317,
102,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": -17,
"op": 423
},
{
"ind": 4,
"ty": 2,
"nm": "cloud_1.png",
"parent": 1,
"refId": "cloud_1",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 1,
"k": [
{
"t": -35,
"s": [
-5
]
},
{
"t": 60,
"s": [
2
]
}
]
},
"p": {
"a": 1,
"k": [
{
"t": -35,
"s": [
537.999,
164.3,
0
]
},
{
"t": 13,
"s": [
-385.998,
477.299,
0
]
},
{
"t": 61,
"s": [
-1318.001,
786.3,
0
]
}
]
},
"a": {
"a": 0,
"k": [
535,
153,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": -35,
"op": 407
},
{
"ind": 5,
"ty": 2,
"nm": "cloud_3.png",
"parent": 1,
"refId": "cloud_3",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 108,
"s": [
434,
-20,
0
]
},
{
"t": 153,
"s": [
-1190,
454,
0
]
}
]
},
"a": {
"a": 0,
"k": [
446.5,
151.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 108,
"op": 558
},
{
"ind": 6,
"ty": 2,
"nm": "cloud_2.png",
"parent": 1,
"refId": "cloud_2",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 103,
"s": [
308,
140,
0
]
},
{
"t": 168,
"s": [
-1060,
550,
0
]
}
]
},
"a": {
"a": 0,
"k": [
317,
102,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 103,
"op": 543
},
{
"ind": 7,
"ty": 2,
"nm": "cloud_1.png",
"parent": 1,
"refId": "cloud_1",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 1,
"k": [
{
"t": 84,
"s": [
-5
]
},
{
"t": 179,
"s": [
2
]
}
]
},
"p": {
"a": 1,
"k": [
{
"t": 84,
"s": [
537.999,
164.3,
0
]
},
{
"t": 132,
"s": [
-385.998,
477.299,
0
]
},
{
"t": 180,
"s": [
-1318.001,
786.3,
0
]
}
]
},
"a": {
"a": 0,
"k": [
535,
153,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 84,
"op": 526
},
{
"ind": 8,
"ty": 2,
"nm": "cloud_3.png",
"parent": 1,
"refId": "cloud_3",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 48,
"s": [
434,
-20,
0
]
},
{
"t": 93,
"s": [
-1190,
454,
0
]
}
]
},
"a": {
"a": 0,
"k": [
446.5,
151.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 48,
"op": 498
},
{
"ind": 9,
"ty": 2,
"nm": "cloud_2.png",
"parent": 1,
"refId": "cloud_2",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 43,
"s": [
308,
140,
0
]
},
{
"t": 108,
"s": [
-1060,
550,
0
]
}
]
},
"a": {
"a": 0,
"k": [
317,
102,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 43,
"op": 483
},
{
"ind": 10,
"ty": 2,
"nm": "cloud_1.png",
"parent": 1,
"refId": "cloud_1",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 1,
"k": [
{
"t": 24,
"s": [
-5
]
},
{
"t": 119,
"s": [
2
]
}
]
},
"p": {
"a": 1,
"k": [
{
"t": 24,
"s": [
537.999,
164.3,
0
]
},
{
"t": 72,
"s": [
-385.998,
477.299,
0
]
},
{
"t": 120,
"s": [
-1318.001,
786.3,
0
]
}
]
},
"a": {
"a": 0,
"k": [
535,
153,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 24,
"op": 466
}
],
"markers": []
}
\ No newline at end of file
const cloud_front = {
"v": "5.6.10",
"fr": 30,
"ip": 0,
"op": 120,
"w": 750,
"h": 1624,
"nm": "cloud_front",
"layers": [
{
"ind": 1,
"ty": 2,
"nm": "control",
"refId": "cloud_7",
"ks": {
"o": {
"a": 0,
"k": 1
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
997,
652,
0
]
},
{
"t": 59,
"s": [
997,
675,
0
]
},
{
"t": 120,
"s": [
997,
652,
0
]
}
]
},
"a": {
"a": 0,
"k": [
249,
110,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 450
},
{
"ind": 2,
"ty": 2,
"nm": "cloud_7.png",
"parent": 1,
"refId": "a5bbb59e-f2cb-4599-a952-76f361200a24",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": -35,
"s": [
249,
110,
0
]
},
{
"t": 40,
"s": [
-1009,
442,
0
]
}
]
},
"a": {
"a": 0,
"k": [
249,
110,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": -35,
"op": 415
},
{
"ind": 3,
"ty": 2,
"nm": "cloud_6.png",
"parent": 1,
"refId": "cloud_6",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": -60,
"s": [
306,
-264,
0
]
},
{
"t": 20,
"s": [
-1040,
146,
0
]
}
]
},
"a": {
"a": 0,
"k": [
298.5,
130,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": -60,
"op": 390
},
{
"ind": 4,
"ty": 2,
"nm": "cloud_5.png",
"parent": 1,
"refId": "cloud_5",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": -29,
"s": [
558,
-288,
0
]
},
{
"t": 46,
"s": [
-1300,
382,
0
]
}
]
},
"a": {
"a": 0,
"k": [
537.5,
191.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": -29,
"op": 421
},
{
"ind": 5,
"ty": 2,
"nm": "cloud_4.png",
"parent": 1,
"refId": "cloud_4",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": -51,
"s": [
154,
-64,
0
]
},
{
"t": 9,
"s": [
-894,
270,
0
]
}
]
},
"a": {
"a": 0,
"k": [
144.5,
74,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": -51,
"op": 399
},
{
"ind": 6,
"ty": 2,
"nm": "cloud_7.png",
"parent": 1,
"refId": "a5bbb59e-f2cb-4599-a952-76f361200a24",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 85,
"s": [
249,
110,
0
]
},
{
"t": 160,
"s": [
-1009,
442,
0
]
}
]
},
"a": {
"a": 0,
"k": [
249,
110,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 85,
"op": 535
},
{
"ind": 7,
"ty": 2,
"nm": "cloud_6.png",
"parent": 1,
"refId": "cloud_6",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 60,
"s": [
306,
-264,
0
]
},
{
"t": 140,
"s": [
-1040,
146,
0
]
}
]
},
"a": {
"a": 0,
"k": [
298.5,
130,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 60,
"op": 510
},
{
"ind": 8,
"ty": 2,
"nm": "cloud_5.png",
"parent": 1,
"refId": "cloud_5",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 91,
"s": [
558,
-288,
0
]
},
{
"t": 166,
"s": [
-1300,
382,
0
]
}
]
},
"a": {
"a": 0,
"k": [
537.5,
191.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 91,
"op": 541
},
{
"ind": 9,
"ty": 2,
"nm": "cloud_4.png",
"parent": 1,
"refId": "cloud_4",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 69,
"s": [
154,
-64,
0
]
},
{
"t": 129,
"s": [
-894,
270,
0
]
}
]
},
"a": {
"a": 0,
"k": [
144.5,
74,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 69,
"op": 519
},
{
"ind": 10,
"ty": 2,
"nm": "cloud_7.png",
"parent": 1,
"refId": "a5bbb59e-f2cb-4599-a952-76f361200a24",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 25,
"s": [
249,
110,
0
]
},
{
"t": 100,
"s": [
-1009,
442,
0
]
}
]
},
"a": {
"a": 0,
"k": [
249,
110,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 25,
"op": 475
},
{
"ind": 11,
"ty": 2,
"nm": "cloud_6.png",
"parent": 1,
"refId": "cloud_6",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
306,
-264,
0
]
},
{
"t": 80,
"s": [
-1040,
146,
0
]
}
]
},
"a": {
"a": 0,
"k": [
298.5,
130,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 450
},
{
"ind": 12,
"ty": 2,
"nm": "cloud_5.png",
"parent": 1,
"refId": "cloud_5",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 31,
"s": [
558,
-288,
0
]
},
{
"t": 106,
"s": [
-1300,
382,
0
]
}
]
},
"a": {
"a": 0,
"k": [
537.5,
191.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 31,
"op": 481
},
{
"ind": 13,
"ty": 2,
"nm": "cloud_4.png",
"parent": 1,
"refId": "cloud_4",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 9,
"s": [
154,
-64,
0
]
},
{
"t": 69,
"s": [
-894,
270,
0
]
}
]
},
"a": {
"a": 0,
"k": [
144.5,
74,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 9,
"op": 459
}
],
"markers": []
}
\ No newline at end of file
const egg_break = {
"v": "5.6.10",
"fr": 30,
"ip": 0,
"op": 45,
"w": 750,
"h": 1624,
"nm": "egg_break",
"layers": [
{
"ind": 1,
"ty": 2,
"nm": "egg_1.png",
"refId": "egg_1",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 0,
"k": [
375,
822,
0
]
},
"a": {
"a": 0,
"k": [
300.5,
238.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 20,
"op": 469
},
{
"ind": 2,
"ty": 2,
"nm": "light_1.png",
"refId": "light_1",
"ks": {
"o": {
"a": 1,
"k": [
{
"t": 27,
"s": [
0
]
},
{
"t": 42,
"s": [
80
]
}
]
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 0,
"k": [
374,
816,
0
]
},
"a": {
"a": 0,
"k": [
557.5,
493,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 27,
"s": [
64,
64,
100
]
},
{
"t": 42,
"s": [
100,
100,
100
]
}
]
}
},
"ip": 27,
"op": 457
},
{
"ind": 3,
"ty": 2,
"nm": "light.png",
"refId": "light",
"ks": {
"o": {
"a": 1,
"k": [
{
"t": 14,
"s": [
0
]
},
{
"t": 20,
"s": [
90
]
}
]
},
"r": {
"a": 0,
"k": -7
},
"p": {
"a": 0,
"k": [
342,
717,
0
]
},
"a": {
"a": 0,
"k": [
89.5,
517,
0
]
},
"s": {
"a": 0,
"k": [
100,
120,
100
]
}
},
"ip": 14,
"op": 464
},
{
"ind": 4,
"ty": 2,
"nm": "light.png",
"refId": "light",
"ks": {
"o": {
"a": 1,
"k": [
{
"t": 10,
"s": [
0
]
},
{
"t": 16,
"s": [
90
]
}
]
},
"r": {
"a": 0,
"k": 15
},
"p": {
"a": 0,
"k": [
420,
698,
0
]
},
"a": {
"a": 0,
"k": [
89.5,
517,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 10,
"s": [
100,
40,
100
]
},
{
"t": 16,
"s": [
100,
100,
100
]
}
]
}
},
"ip": 10,
"op": 460
},
{
"ind": 5,
"ty": 2,
"nm": "light.png",
"refId": "light",
"ks": {
"o": {
"a": 1,
"k": [
{
"t": 6,
"s": [
0
]
},
{
"t": 12,
"s": [
70
]
}
]
},
"r": {
"a": 0,
"k": 28
},
"p": {
"a": 0,
"k": [
493,
690,
0
]
},
"a": {
"a": 0,
"k": [
89.5,
517,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 6,
"s": [
100,
30,
100
]
},
{
"t": 12,
"s": [
100,
90,
100
]
}
]
}
},
"ip": 6,
"op": 456
},
{
"ind": 6,
"ty": 2,
"nm": "light_s.png",
"refId": "light_s",
"ks": {
"o": {
"a": 1,
"k": [
{
"t": 2,
"s": [
0
]
},
{
"t": 8,
"s": [
70
]
}
]
},
"r": {
"a": 0,
"k": 52
},
"p": {
"a": 0,
"k": [
578,
640,
0
]
},
"a": {
"a": 0,
"k": [
89.5,
429.17,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 2,
"s": [
100,
40,
100
]
},
{
"t": 8,
"s": [
100,
80,
100
]
}
]
}
},
"ip": 2,
"op": 452
},
{
"ind": 7,
"ty": 2,
"nm": "light_s.png",
"refId": "light_s",
"ks": {
"o": {
"a": 1,
"k": [
{
"t": 0,
"s": [
0
]
},
{
"t": 6,
"s": [
70
]
}
]
},
"r": {
"a": 0,
"k": -47
},
"p": {
"a": 0,
"k": [
143,
727,
0
]
},
"a": {
"a": 0,
"k": [
89.5,
429.17,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 0,
"s": [
100,
40,
100
]
},
{
"t": 6,
"s": [
100,
90,
100
]
}
]
}
},
"ip": 0,
"op": 450
},
{
"ind": 8,
"ty": 2,
"nm": "egg_2.png",
"refId": "egg_2",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 1,
"k": [
{
"t": 42,
"s": [
0
]
},
{
"t": 45,
"s": [
-7
]
}
]
},
"p": {
"a": 1,
"k": [
{
"t": 42,
"s": [
128,
717,
0
]
},
{
"t": 45,
"s": [
124,
692,
0
]
}
]
},
"a": {
"a": 0,
"k": [
50,
264,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 20,
"op": 446
},
{
"ind": 9,
"ty": 2,
"nm": "crevice_5.png",
"refId": "crevice_5",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": -20
},
"p": {
"a": 0,
"k": [
121.5,
738,
0
]
},
"a": {
"a": 0,
"k": [
1.578,
5.132,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 0,
"s": [
0,
100,
100
]
},
{
"t": 3,
"s": [
100,
100,
100
]
}
]
}
},
"ip": 0,
"op": 444
},
{
"ind": 10,
"ty": 2,
"nm": "crevice_4.png",
"refId": "crevice_4",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 0,
"k": [
340,
718,
0
]
},
"a": {
"a": 0,
"k": [
32,
35,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 14,
"op": 453
},
{
"ind": 11,
"ty": 2,
"nm": "crevice_3.png",
"refId": "crevice_3",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 15
},
"p": {
"a": 0,
"k": [
469.5,
709.75,
0
]
},
"a": {
"a": 0,
"k": [
101.811,
4.103,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 10,
"s": [
0,
100,
100
]
},
{
"t": 12,
"s": [
100,
100,
100
]
}
]
}
},
"ip": 10,
"op": 450
},
{
"ind": 12,
"ty": 2,
"nm": "crevice_2.png",
"refId": "crevice_2",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": -40
},
"p": {
"a": 0,
"k": [
550.25,
643,
0
]
},
"a": {
"a": 0,
"k": [
107.324,
6.513,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 6,
"s": [
0,
100,
100
]
},
{
"t": 8,
"s": [
100,
100,
100
]
}
]
}
},
"ip": 6,
"op": 448
},
{
"ind": 13,
"ty": 2,
"nm": "crevice_1.png",
"refId": "crevice_1",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": -24
},
"p": {
"a": 0,
"k": [
589,
628.25,
0
]
},
"a": {
"a": 0,
"k": [
46,
8.5,
0
]
},
"s": {
"a": 1,
"k": [
{
"t": 2,
"s": [
0,
100,
100
]
},
{
"t": 4,
"s": [
100,
100,
100
]
}
]
}
},
"ip": 2,
"op": 446
},
{
"ind": 14,
"ty": 2,
"nm": "egg_0.png",
"refId": "egg_0",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 0,
"k": [
375,
760,
0
]
},
"a": {
"a": 0,
"k": [
300.5,
300.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 20
}
],
"markers": [
{
"tm": 30,
"cm": "1",
"dr": 0
}
]
}
\ No newline at end of file
const egg_loop = {
"v": "5.6.10",
"fr": 30,
"ip": 0,
"op": 90,
"w": 750,
"h": 1624,
"nm": "egg_loop",
"layers": [
{
"ind": 2,
"ty": 2,
"nm": "egg_0.png",
"refId": "egg_0",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
375,
760,
0
]
},
{
"t": 45,
"s": [
375,
782,
0
]
},
{
"t": 90,
"s": [
375,
760,
0
]
}
],
"x": "var $bm_rt;\n$bm_rt = loopOut('cycle', 0);"
},
"a": {
"a": 0,
"k": [
300.5,
300.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 450
}
],
"markers": []
}
\ No newline at end of file
const res = {
"cloud_5.png": {
"x": 2,
"y": 2,
"w": 1075,
"h": 383,
"ox": 0,
"oy": 0,
"sw": 1075,
"sh": 383,
"ro": false
},
"cloud_1.png": {
"x": 2,
"y": 387,
"w": 1070,
"h": 306,
"ox": 0,
"oy": 0,
"sw": 1070,
"sh": 306,
"ro": false
},
"light_1.png": {
"x": 2,
"y": 695,
"w": 1015,
"h": 481,
"ox": 0,
"oy": 29,
"sw": 1119,
"sh": 510,
"ro": false
},
"cloud_3.png": {
"x": 1079,
"y": 2,
"w": 893,
"h": 303,
"ox": 0,
"oy": 0,
"sw": 893,
"sh": 303,
"ro": true
},
"cloud_2.png": {
"x": 2,
"y": 1178,
"w": 634,
"h": 204,
"ox": 0,
"oy": 0,
"sw": 634,
"sh": 204,
"ro": false
},
"egg_0.png": {
"x": 1384,
"y": 2,
"w": 601,
"h": 601,
"ox": 0,
"oy": 0,
"sw": 601,
"sh": 601,
"ro": false
},
"egg_1.png": {
"x": 1384,
"y": 605,
"w": 601,
"h": 477,
"ox": 0,
"oy": 0,
"sw": 601,
"sh": 477,
"ro": false
},
"cloud_6.png": {
"x": 1019,
"y": 1084,
"w": 597,
"h": 260,
"ox": 0,
"oy": 0,
"sw": 597,
"sh": 260,
"ro": false
},
"egg_2.png": {
"x": 638,
"y": 1178,
"w": 550,
"h": 344,
"ox": 0,
"oy": 0,
"sw": 550,
"sh": 344,
"ro": true
},
"light.png": {
"x": 2,
"y": 1384,
"w": 143,
"h": 518,
"ox": 0,
"oy": 0,
"sw": 143,
"sh": 518,
"ro": true
},
"cloud_7.png": {
"x": 1618,
"y": 1084,
"w": 498,
"h": 220,
"ox": 0,
"oy": 0,
"sw": 498,
"sh": 220,
"ro": true
},
"light_s.png": {
"x": 984,
"y": 1584,
"w": 143,
"h": 430,
"ox": 0,
"oy": 0,
"sw": 143,
"sh": 430,
"ro": true
},
"cloud_4.png": {
"x": 1019,
"y": 897,
"w": 289,
"h": 148,
"ox": 0,
"oy": 0,
"sw": 289,
"sh": 148,
"ro": false
},
"crevice_2.png": {
"x": 522,
"y": 1384,
"w": 108,
"h": 11,
"ox": 0,
"oy": 0,
"sw": 108,
"sh": 11,
"ro": false
},
"crevice_3.png": {
"x": 522,
"y": 1397,
"w": 106,
"h": 9,
"ox": 0,
"oy": 0,
"sw": 106,
"sh": 9,
"ro": false
},
"crevice_4.png": {
"x": 1310,
"y": 897,
"w": 64,
"h": 70,
"ox": 0,
"oy": 0,
"sw": 64,
"sh": 70,
"ro": true
},
"crevice_5.png": {
"x": 1019,
"y": 695,
"w": 55,
"h": 10,
"ox": 0,
"oy": 0,
"sw": 55,
"sh": 10,
"ro": false
},
"crevice_1.png": {
"x": 1019,
"y": 707,
"w": 48,
"h": 16,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 16,
"ro": false
}
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> -->
<!-- 小程序分享得用这个 -->
<!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script> -->
<!-- 易盾js -->
<!-- <script type="text/javascript" src="//cstaticdun.126.net/load.min.js"></script> -->
<!-- <script src="libs/zepto.min.js"></script> -->
<!-- <script src="libs/p2.js"></script> -->
<script src="../build/fyge.min.js"></script>
<script src="./js/res.js"></script>
<script src="./js/egg_break.js"></script>
<script src="./js/egg_loop.js"></script>
<script src="./js/cloud_back.js"></script>
<script src="./js/cloud_front.js"></script>
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: #eeeeee;
}
</style>
</head>
<body>
<div id="cusEngine" style="line-height:0;font-size:0">
<canvas id="canvas" style="width: 100%;height: 100%"></canvas>
</div>
</body>
<script>
window.addEventListener("load", async function () {
//获取canvas
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1)
//小程序上canvas用自己的方式建
// var canvas = await new Promise((r) => {
// my.createCanvas({
// id: 'canvas',
// success: (ccc) => {
// const dpr = my.getSystemInfoSync().pixelRatio
// const windowWidth = my.getSystemInfoSync().windowWidth;
// const windowHeight = my.getSystemInfoSync().windowHeight;
// ccc.width = windowWidth * dpr + dpr;//重新修改会有误差
// ccc.height = windowHeight * dpr + dpr;
// r(ccc);
// }
// })
// })
var sysInfo;
//@ts-ignore 存在my就初始化
if (my) {
FYGE.initedByCanvas(canvas)
//@ts-ignore 存在my就初始化
sysInfo = my.getSystemInfoSync()
}
//建舞台
var stage = new FYGE.Stage(
canvas,
750,//设计宽度,按设计搞给的就行
1624,//设计高度
sysInfo && sysInfo.windowWidth || document.body.clientWidth,
sysInfo && sysInfo.windowHeight || document.body.clientHeight,
FYGE.RENDERER_TYPE.CANVAS
);
//stage初始化
stage.addEventListener(FYGE.Event.INIT_STAGE, () => {
//添加个背景
// var a = stage.addChild(new FYGE.Graphics())
// .beginFill(0x000000, 0.7)
// .drawRect(0, 0, 750, 1624)
// .endFill()
//资源
FYGE.GlobalLoader.loadImage((s, image) => {
if (s) {
//会进TextureCache
FYGE.createTextureSheet(new FYGE.BaseTexture(image), res)
var a = stage.addChild(new FYGE.Lottie(cloud_back))
a.play();
//加个lottie
var b = stage.addChild(new FYGE.Lottie(egg_break))
b.play();
// var b = stage.addChild(new FYGE.Lottie(egg_loop))
// b.play();
var b = stage.addChild(new FYGE.Lottie(cloud_front))
b.play()
} else {
}
}, "./res/res.png")
}, this);
//循环
loop();
function loop() {
FYGE.Tween.flush()
stage.flush();
FYGE.getRequestAnimationFrame()(loop);
}
})
</script>
</html>
\ No newline at end of file
......@@ -4,7 +4,7 @@ var path = require('path');
var webpack = require('webpack')
module.exports = {
mode: "production",//'development',
mode: "production",//'development',production
entry: {
"fyge.min": "./src/index.ts",
},
......@@ -27,7 +27,8 @@ module.exports = {
plugins: [
new UglifyJSPlugin(
{ sourceMap: true }
), new webpack.DefinePlugin({
),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
})
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment