Skip to content

Commit

Permalink
Merge pull request #26 from galacean/feat/1.1
Browse files Browse the repository at this point in the history
Merge origin/feat/1.1 into origin/feat/main
  • Loading branch information
RGCHN authored Apr 16, 2024
2 parents 8c99195 + 2f999f3 commit 2c958b7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
5 changes: 1 addition & 4 deletions fallback/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
RenderLevel,
SpriteItem,
TemplateImage,
VideoImage,
FilterItem,
} from '../src';
import { CAMERA_CLIP_MODE_NORMAL, ItemEndBehavior, ItemType } from '../src';
Expand Down Expand Up @@ -93,7 +92,7 @@ function getStandardJSONFromV0 (json: any): JSONScene {
return ret;
}

export function getStandardImage (image: any, index: number, imageTags: RenderLevel[]): TemplateImage | Image | CompressedImage | VideoImage {
export function getStandardImage (image: any, index: number, imageTags: RenderLevel[]): TemplateImage | Image | CompressedImage {
const renderLevel = imageTags[index];

const oriY = image.oriY;
Expand Down Expand Up @@ -126,11 +125,9 @@ export function getStandardImage (image: any, index: number, imageTags: RenderLe
} else if (image.url) {
return {
url: image.url,
type: image.type,
webp: image.webp,
renderLevel,
oriY,
loop: image.loop,
};
} else if (image && image.sourceType) {
return image;
Expand Down
16 changes: 10 additions & 6 deletions src/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@ export interface TemplateContentV1 extends TemplateContentBase {
backgroundHeight: number,
}

/**
* 动态换图类型
* @since 1.3.0
*/
export enum BackgroundType {
video = 'video',
image = 'image',
}

export interface TemplateContentV2 extends TemplateContentBase {
v: 2,
content?: StringTemplate,
// 绘制 canvas 的背景图片,替换掉原来的那张图片,如果没有就不替换
background?: {
type: BackgroundType,
name: string,
url: string,
},
Expand Down Expand Up @@ -135,8 +144,3 @@ export interface CompressedImage extends Image {
pvrtc?: string,
},
}

export interface VideoImage extends Image {
type: 'video',
loop?: boolean,
}
24 changes: 20 additions & 4 deletions src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,21 +642,37 @@ export interface PluginGyroscopeTarget {
*/
name: string,
/**
* x轴最小值
* x 轴位移最小值
*/
xMin: number,
/**
* x轴最大值
* x 轴位移最大值
*/
xMax: number,
/**
* y轴最小值
* y 轴位移最小值
*/
yMin: number,
/**
* y轴最大值
* y 轴位移最大值
*/
yMax: number,
/**
* 绕 x 轴(水平)旋转角度最小值
*/
hMin: number,
/**
* 绕 x 轴(水平)旋转角度最大值
*/
hMax: number,
/**
* 绕 y 轴(垂直)旋转角度最小值
*/
vMin: number,
/**
* 绕 y 轴(垂直)旋转角度最大值
*/
vMax: number,
}

/**
Expand Down

0 comments on commit 2c958b7

Please sign in to comment.