|
@@ -117,14 +117,16 @@ async function init() {
|
|
|
adPlatform.onResourcesLoaded();
|
|
adPlatform.onResourcesLoaded();
|
|
|
|
|
|
|
|
// 设置固定顶栏 logo(图标 + 文字)
|
|
// 设置固定顶栏 logo(图标 + 文字)
|
|
|
- (document.getElementById("app-logo") as HTMLImageElement).src = adAssets.logoUrl;
|
|
|
|
|
|
|
+ (document.getElementById("app-logo") as HTMLImageElement).src =
|
|
|
|
|
+ adAssets.logoUrl;
|
|
|
(document.getElementById("app-logo-txt") as HTMLImageElement).src =
|
|
(document.getElementById("app-logo-txt") as HTMLImageElement).src =
|
|
|
adAssets.logoTxtUrl;
|
|
adAssets.logoTxtUrl;
|
|
|
|
|
|
|
|
// 预加载 promo 图片,避免动画播放时图片刚加载导致布局跳变
|
|
// 预加载 promo 图片,避免动画播放时图片刚加载导致布局跳变
|
|
|
(document.getElementById("promo-coloring") as HTMLImageElement).src =
|
|
(document.getElementById("promo-coloring") as HTMLImageElement).src =
|
|
|
adAssets.coloringPagesUrl;
|
|
adAssets.coloringPagesUrl;
|
|
|
- (document.getElementById("promo-slogon") as HTMLImageElement).src = adAssets.slogonUrl;
|
|
|
|
|
|
|
+ (document.getElementById("promo-slogon") as HTMLImageElement).src =
|
|
|
|
|
+ adAssets.slogonUrl;
|
|
|
|
|
|
|
|
let taskList: number[] = [];
|
|
let taskList: number[] = [];
|
|
|
|
|
|
|
@@ -213,16 +215,16 @@ async function init() {
|
|
|
|
|
|
|
|
scene.addLayer(new LineArtLayer(scene, resource.page, width, height));
|
|
scene.addLayer(new LineArtLayer(scene, resource.page, width, height));
|
|
|
|
|
|
|
|
- scene.addLayer(
|
|
|
|
|
- new BorderLayer(
|
|
|
|
|
- scene,
|
|
|
|
|
- 0,
|
|
|
|
|
- 0,
|
|
|
|
|
- fillerData.width,
|
|
|
|
|
- fillerData.height,
|
|
|
|
|
- 0xff222222,
|
|
|
|
|
- ),
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // scene.addLayer(
|
|
|
|
|
+ // new BorderLayer(
|
|
|
|
|
+ // scene,
|
|
|
|
|
+ // 0,
|
|
|
|
|
+ // 0,
|
|
|
|
|
+ // fillerData.width,
|
|
|
|
|
+ // fillerData.height,
|
|
|
|
|
+ // 0xff222222,
|
|
|
|
|
+ // ),
|
|
|
|
|
+ // );
|
|
|
|
|
|
|
|
// let mask = new Mask(gl, fillerData)
|
|
// let mask = new Mask(gl, fillerData)
|
|
|
// resource.config[0].areas.forEach(area => mask.addArea(area))
|
|
// resource.config[0].areas.forEach(area => mask.addArea(area))
|
|
@@ -412,7 +414,8 @@ function cssInitColorProgress(i: number, percent: number) {
|
|
|
function cssAdjustScroll(fd: FillerData) {
|
|
function cssAdjustScroll(fd: FillerData) {
|
|
|
let wrapper = document.getElementById("color-btns")!;
|
|
let wrapper = document.getElementById("color-btns")!;
|
|
|
let itemWidth = wrapper.scrollWidth / fd.data.areaGroups.length;
|
|
let itemWidth = wrapper.scrollWidth / fd.data.areaGroups.length;
|
|
|
- let scrollpos = itemWidth * fd.currentGroupIndex + itemWidth / 2 - wrapper.clientWidth / 2;
|
|
|
|
|
|
|
+ let scrollpos =
|
|
|
|
|
+ itemWidth * fd.currentGroupIndex + itemWidth / 2 - wrapper.clientWidth / 2;
|
|
|
scrollpos = Math.max(0, scrollpos);
|
|
scrollpos = Math.max(0, scrollpos);
|
|
|
try {
|
|
try {
|
|
|
wrapper.scroll({ left: scrollpos, top: 0, behavior: "smooth" });
|
|
wrapper.scroll({ left: scrollpos, top: 0, behavior: "smooth" });
|
|
@@ -455,15 +458,17 @@ function cssOnFinish(
|
|
|
// 动画结束后隐藏元素
|
|
// 动画结束后隐藏元素
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
// toolbarBottom.style.display = 'none';
|
|
// toolbarBottom.style.display = 'none';
|
|
|
|
|
+ const lw = adTheme.frameLineWidth || 16;
|
|
|
|
|
+ const offset = lw / 4;
|
|
|
scene.addLayer(
|
|
scene.addLayer(
|
|
|
new FrameLayer(
|
|
new FrameLayer(
|
|
|
scene,
|
|
scene,
|
|
|
- -4,
|
|
|
|
|
- -4,
|
|
|
|
|
- scene.fillerData!.width + 8,
|
|
|
|
|
- scene.fillerData!.height + 8,
|
|
|
|
|
- 0xff9bceed,
|
|
|
|
|
- 16,
|
|
|
|
|
|
|
+ -offset,
|
|
|
|
|
+ -offset,
|
|
|
|
|
+ scene.fillerData!.width + offset * 2,
|
|
|
|
|
+ scene.fillerData!.height + offset * 2,
|
|
|
|
|
+ cssHexToFrameColor(adTheme.frameColor || "#edce9b"),
|
|
|
|
|
+ lw,
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
hintLayer.enabled = false; // replay 期间隐藏 hint 覆盖层
|
|
hintLayer.enabled = false; // replay 期间隐藏 hint 覆盖层
|
|
@@ -545,6 +550,14 @@ function showToast(message: string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 撒花动画,使用js-confetti库
|
|
// 撒花动画,使用js-confetti库
|
|
|
|
|
+/** CSS hex (#RRGGBB) → FrameLayer 颜色值 (0xAABBGGRR little-endian) */
|
|
|
|
|
+function cssHexToFrameColor(hex: string): number {
|
|
|
|
|
+ const r = parseInt(hex.slice(1, 3), 16);
|
|
|
|
|
+ const g = parseInt(hex.slice(3, 5), 16);
|
|
|
|
|
+ const b = parseInt(hex.slice(5, 7), 16);
|
|
|
|
|
+ return (0xff << 24) | (b << 16) | (g << 8) | r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function confetti() {
|
|
function confetti() {
|
|
|
const jsConfetti = new JSConfetti();
|
|
const jsConfetti = new JSConfetti();
|
|
|
jsConfetti.addConfetti({ confettiNumber: 80 });
|
|
jsConfetti.addConfetti({ confettiNumber: 80 });
|