Frame

Frame

Animation's Frame

Constructor

new Frame(properties)

Source:
Create an animation's frame.
Parameters:
Name Type Description
properties Object properties

Methods

(static) addRole(role)

Source:
add Role to Frame.
Example
Scene.Frame.addRole("property");
Scene.Frame.addRole("transform");
Scene.Frame.addRole("filter");
Parameters:
Name Type Description
role String property role(property, transform, filter)

clone() → {Scene.Frame}

Source:
copy frame.
Example
frame.copy();
Returns:
An instance of copy
Type
Scene.Frame

format(role, format, separator) → {Frame}

Source:
get string into format for properties.
Example
var frame = new Scene.Frame({
	a: 1,
	b: 2,
	c: 3,
	transform: {
		translate: "10px, 10px",
		scale: 1,
	}
});
frame.format("property", "$1:$2;", ""); // => a:1;b:2;c:3;
frame.format("transform", "$1($2)", " "); // => translate(10px,10px) scale(1)
Parameters:
Name Type Description
role String property role(property, transform, filter)
format String string format to get properties.
separator String separator between properties.
Returns:
An instance itself
Type
Frame

get(role, property) → {Number|String|Scene.PropertyObejct}

Source:
get property value
Example
frame.get("property", "display") // => "none", "block", ....
Parameters:
Name Type Description
role String property role(property, transform, filter)
property String property name
Returns:
property value
Type
Number | String | Scene.PropertyObejct

getTransform(property) → {Object}

Source:
get transform's value in the frame
Example
item.getTransform(10, "scale");
// same
const frame = item.getFrame(10);
frame.getTransform("scale");
Parameters:
Name Type Description
property String property's name
Returns:
property's value
Type
Object

has(role, property) → {Boolean}

Source:
check that has property.
Example
frame.has("property", "display") // => true or false
Parameters:
Name Type Description
role String property role(property, transform, filter)
property String property name
Returns:
true : has property, false : has not property
Type
Boolean

load(properties) → {Frame}

Source:
load json of properties.
Example
frame.load({
	display: "none"
});
Parameters:
Name Type Description
properties Object properties
Returns:
An instance itself
Type
Frame

merge(frame) → {Scene.Frame}

Source:
merge one frame to other frame.
Example
frame.merge(frame2);
Parameters:
Name Type Description
frame Scene.Frame target frame.
Returns:
An instance itself
Type
Scene.Frame

remove(role, property) → {Frame}

Source:
remove property value
Example
frame.remove("property", "display")
Parameters:
Name Type Description
role String property role(property, transform, filter)
property String property name
Returns:
An instance itself
Type
Frame

set(role, property, value) → {Frame}

Source:
set property
Example
// one parameter
frame.set({
	display: "none",
	transform: {
		translate: "10px, 10px",
		scale: "1",
	},
	filter: {
		brightness: "50%",
		grayscale: "100%"
	}
});

// two parameters
frame.set("transform", {
	translate: "10px, 10px",
	scale: "1",
});

// three parameters
frame.set("property", "display", "none");
Parameters:
Name Type Description
role Object | String property role(property, transform, filter)
property Object | String property name
value Object | String property value
Returns:
An instance itself
Type
Frame

setTransform(propertiesopt, valueopt) → {SceneItem}

Source:
set transform to the frame.
Example
item.setTransform(10, "scale", "1,1");
// same
const frame = item.getFrame(10);
frame.setTransform("scale", "1,1");
Parameters:
Name Type Attributes Description
properties String | Object <optional>
property's name or properties
value Object <optional>
property's value
Returns:
An instance itself
Type
SceneItem