跳转至

【说明】

这是根据Phaser3 API文档中各类之页面右侧的目录整理的,略作说明,或增加代码示例。可做便览之用。

Phaser 3 API Documentation - Namespace: Actions#

Phaser. Actions#

Phaser. Actions包含一组静态方法,可以对一组游戏对象进行批量处理,应用相同的动作。常常结合逻辑分组Group.getChildren()一起使用。 条目要包含要处理的属性、方法,否则无效。

@actions\place on circle.js

1
2
3
4
var circle = new Phaser.Geom.Circle(400, 300, 260);
group = this.add.group({ key: 'ball', frameQuantity: 32 });
// 把组中游戏对象放置在圆环上
Phaser.Actions.PlaceOnCircle(group.getChildren(), circle);

Phaser. Actions#

Methods#

AlignTo(items, position [, offsetX] [, offsetY])#

Angle(items, value [, step] [, index] [, direction])#

逐一设置角度

Call(items, callback, context)#

逐一调用某个方法

GetFirst(items, compare [, index])#

获取符合比较条件的第一个条目(如GetFirst(group.getChildren(), { scaleX: 0.5, alpha: 1 }, index)

GetLast(items, compare [, index])#

GridAlign(items, options)#

逐一对齐栅格

IncAlpha(items, value [, step] [, index] [, direction])#

逐一渐进地incrementally更改透明度(如IncAlpha(group.getChildren(), value, step)

IncX(items, value [, step] [, index] [, direction])#

IncXY(items, x [, y] [, stepX] [, stepY] [, index] [, direction])#

IncY(items, value [, step] [, index] [, direction])#

PlaceOnCircle(items, circle [, startAngle] [, endAngle])#

逐一均匀地放置在圆周上

PlaceOnEllipse(items, ellipse [, startAngle] [, endAngle])#

PlaceOnLine(items, line)#

PlaceOnRectangle(items, rect [, shift])#

顺时针逐一均匀地放置在方框上(shift控制起始位置)

PlaceOnTriangle(items, triangle [, stepRate])#

PlayAnimation(items, key [, startFrame])#

全部播放动画

PropertyValueInc(items, key, value [, step] [, index] [, direction])#

逐一渐进地增加属性值

PropertyValueSet(items, key, value [, step] [, index] [, direction])#

逐一渐设置属性值

RandomCircle(items, circle)#

逐一随机地放在一个圆内

RandomEllipse(items, ellipse)#

RandomLine(items, line)#

RandomRectangle(items, rect)#

RandomTriangle(items, triangle)#

Rotate(items, value [, step] [, index] [, direction])#

逐一增加弧度

RotateAround(items, point, angle)#

逐一旋转

RotateAroundDistance(items, point, angle, distance)#

ScaleX(items, value [, step] [, index] [, direction])#

ScaleXY(items, scaleX [, scaleY] [, stepX] [, stepY] [, index] [, direction])#

ScaleY(items, value [, step] [, index] [, direction])#

SetAlpha(items, value [, step] [, index] [, direction])#

SetBlendMode(items, value [, index] [, direction])#

SetDepth(items, value [, step] [, index] [, direction])#

SetHitArea(items, hitArea, hitAreaCallback)#

SetOrigin(items, originX [, originY] [, stepX] [, stepY] [, index] [, direction])#

SetRotation(items, value [, step] [, index] [, direction])#

SetScale(items, scaleX [, scaleY] [, stepX] [, stepY] [, index] [, direction])#

SetScaleX(items, value [, step] [, index] [, direction])#

SetScaleY(items, value [, step] [, index] [, direction])#

SetScrollFactor(items, scrollFactorX [, scrollFactorY] [, stepX] [, stepY] [, index] [, direction])#

SetScrollFactorX(items, value [, step] [, index] [, direction])#

SetScrollFactorY(items, value [, step] [, index] [, direction])#

SetTint(items, topLeft [, topRight] [, bottomLeft] [, bottomRight])#

SetVisible(items, value [, index] [, direction])#

SetX(items, value [, step] [, index] [, direction])#

SetXY(items, x [, y] [, stepX] [, stepY] [, index] [, direction])#

SetY(items, value [, step] [, index] [, direction])#

ShiftPosition(items, x, y [, direction] [, output])#

逐一交换位置

Shuffle(items)#

打乱层次。

SmootherStep(items, property, min, max [, inc])#

属性值高度平滑渐变

SmoothStep(items, property, min, max [, inc])#

Spread(items, property, min, max [, inc])#

属性值平展(或渐变)

ToggleVisible(items)#

WrapInRectangle(items, rect [, padding])#

在方形区域内折行排列

评论