Animation Blocks

Basic Animation

{"func":"blockAnimationSimpleSwitchCostumeAndWait"}

Animate And Wait

Animate the character for one animation cycle and wait.

Parameters:

animation: The animation to perform.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockMotionPointDirection","values":[{"type":"string","value":"90"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Walk"}]}}} Add to my Backpack


{"func":"blockAnimationSetSpeed"}

Set Animation Speed

Sets the animation speed.

Parameters:

value: percentage of the speed

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"slow motion"}],"next":{"func":"blockAnimationSetSpeed","values":[{"type":"number","value":20}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Walk"}],"next":{"func":"blockAnimationSetSpeed","values":[{"type":"number","value":"100"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleSwitchCostume"}

Animate

Animate the character for one animation cycle.

Parameters:

animation: The animation to perform.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockControlForever","containers":[{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Jump"}]},{"func":"blockAnimationSimpleSwitchCostume","values":[{"type":"string","value":"Idle"}]}],"containerLabels":[{"type":"wrapper","func":"nop","values":[],"labelText":"else {button:add}"}]}]}} Add to my Backpack


{"func":"blockAnimationAnimate"}

Animate With Name

Animate the character

Parameters:

animation: The animation to perform.

fps: Frames per second to play the animation at.

time: The time to perform the animation.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"slow motion"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Run"},{"type":"number","value":10},{"type":"number","value":3},{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Run"}]}}}} Add to my Backpack


Character Parts

{"func":"blockLooksSetCharacterPart"}

Set Part

Sets a character part.

Parameters:

part: The part to change

skin: The skin to change into

Related Blocks:
{"func":"valueLooksGetCharacterPart"}

Sample Code:
{"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"helmet"}]}],"next":{"func":"blockLooksSetCharacterPart","values":[{"type":"string","value":"Head"},{"type":"string","value":"knight"}]}} Add to my Backpack


{"func":"valueLooksGetCharacterPart"}

Get Part

Get a character part.

Parameters:

part: The part to retrieve

Related Blocks:
{"func":"blockLooksSetCharacterPart"}

Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"a"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksGetCharacterPart","values":[{"type":"string","value":"Right Props"}]},{"type":"string","value":"knight"}]}],"containers":[{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Attack 1"}]}]}} Add to my Backpack


Animation Control

{"func":"blockAnimationWaitFor"}

Wait for Animation

Wait for the animation to finish.

Parameters:

animation: The animation to wait for.

Related Blocks:
{"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"slow motion"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Run"},{"type":"number","value":10},{"type":"number","value":3},{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Run"}]}}}} Add to my Backpack


{"func":"blockAnimationStop"}

Stop Animation

Stop the named animation.

Parameters:

animation: The animation to stop.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"}

Sample Code:
{"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[{"func":"blockAnimationSimpleSwitchCostume","values":[{"type":"string","value":"Run"}]}],"next":{"func":"blockAnimationStop","values":[{"type":"string","value":"Run"}]}}} Add to my Backpack


{"func":"valueAnimationIsRunning"}

Is Animation Running?

Checks to see if the animation is running.

Parameters:

animation: The animation to test for whether it is running or not.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"stop walking"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueAnimationIsRunning","values":[{"type":"string","value":"Walk"}]}],"containers":[{"func":"blockAnimationStop","values":[{"type":"string","value":"Walk"}]}]}} Add to my Backpack


{"func":"registerAnimationDone"}

When Animation Done

When the specified animation is done, this script will be triggered.

Parameters:

name: The animation name

Related Blocks:
{"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerAnimationDone","values":[{"type":"string","value":"jump"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Flip"}]}} Add to my Backpack


{"func":"valueAnimationTime"}

Animation Time

The time it takes for an animation to go for once cycle.

Parameters:

animation: The animation to get the length of.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"walk"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Walk"},{"type":"number","value":"30"},{"type":"wrapper","func":"valueOpMultiply","values":[{"type":"wrapper","func":"valueAnimationTime","values":[{"type":"string","value":"Walk"}]},{"type":"number","value":3}]},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationSimpleMoveTo","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"choice","value":"+"},{"type":"string","value":"100"}]},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"wrapper","func":"valueOpMultiply","values":[{"type":"wrapper","func":"valueAnimationTime","values":[{"type":"string","value":"Walk"}]},{"type":"number","value":3}]},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"walk"}]}}}} Add to my Backpack


Advanced Animation

{"func":"blockAnimationSimpleScaleBy"}

Animate Scaling By

Scale by the specified value in the given time.

Parameters:

scale: Amount to scale by.

time: The time to scale to the specified size.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleScaleTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"grow"}],"next":{"func":"blockAnimationSimpleScaleBy","values":[{"type":"number","value":50},{"type":"number","value":"1"},{"type":"string","value":"grow"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"grow"}]}}} Add to my Backpack


{"func":"blockAnimationSimpleScaleTo"}

Animate Scaling To

Scale to the specified value in the given time.

Parameters:

scale: Amount to scale to.

time: The time to scale to the specified size.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleScaleBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"grow"}],"next":{"func":"blockAnimationSimpleScaleTo","values":[{"type":"number","value":100},{"type":"number","value":"1"},{"type":"string","value":"grow"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"grow"}]}}} Add to my Backpack


{"func":"blockAnimationSimpleMoveBy"}

Animate Move By

Move by the specified x and y in the given time.

Parameters:

x,y: The position to move by.

time: The time to move to the specified position.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleMoveTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"walk"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Walk"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationSimpleMoveBy","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"choice","value":"+"},{"type":"string","value":"100"}]},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"walk"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleMoveTo"}

Animate Move To

Move to the specified x and y in the given time.

Parameters:

x,y: The position to move to.

time: The time to move to the specified position.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleMoveBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"walk"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Walk"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationSimpleMoveTo","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"choice","value":"+"},{"type":"string","value":"100"}]},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"walk"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleRotateBy"}

Animate Rotation By

Animate the rotation by the specified angle.

Parameters:

angle: Amount to rotate by. Use negative value to rotate the other direction.

time: The time to rotate to the specified angle.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleRotateTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"turn"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Idle"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationSimpleRotateBy","values":[{"type":"number","value":45},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"turn"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleRotateTo"}

Animate Rotation To

Animate the rotation to the specified angle.

Parameters:

angle: Amount to rotate by. Use negative value to rotate the other direction.

time: The time to rotate to the specified angle.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleRotateBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"turn"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Idle"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationSimpleRotateTo","values":[{"type":"number","value":90},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"turn"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleBezierBy"}

Animate Bezier Curve By

Animate a bezier curve to the new position.

Parameters:

x,y: Ending position relative to the actor's current position.

cx1,cy1: First control point of the curve.

cx2,cy2: Second control point of the curve.

time: The time to perform the curve.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleBezierTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"jump"}],"next":{"func":"blockMotionGoTo","values":[{"type":"number","value":-50},{"type":"number","value":-150}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Jump"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"jump"}],"next":{"func":"blockAnimationSimpleBezierBy","values":[{"type":"number","value":100},{"type":"number","value":0},{"type":"number","value":-5},{"type":"number","value":75},{"type":"number","value":40},{"type":"number","value":150},{"type":"number","value":"1"},{"type":"string","value":""}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"jump"}]}}}}} Add to my Backpack


{"func":"blockAnimationSimpleBezierTo"}

Animate Bezier Curve To

Animate a bezier curve to the end position.

Parameters:

x,y: Ending position.

cx1,cy1: First control point of the curve.

cx2,cy2: Second control point of the curve.

time: The time to perform the curve.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleBezierBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"jump"}],"next":{"func":"blockMotionGoTo","values":[{"type":"number","value":-50},{"type":"number","value":-150}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Jump"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"jump"}],"next":{"func":"blockAnimationSimpleBezierTo","values":[{"type":"number","value":50},{"type":"number","value":-150},{"type":"number","value":-25},{"type":"number","value":-75},{"type":"number","value":0},{"type":"number","value":0},{"type":"number","value":"1"},{"type":"string","value":"jump"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"jump"}]}}}}} Add to my Backpack


{"func":"blockAnimationSimpleEffectBy"}

Animate Effect By

Perform an effect animation relative to the current effect value.

Parameters:

effect: The effect to perform.

value: The amount of the effect to perform by.

time: The time to perform the effect.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleEffectTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"fade"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Fall Die"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"fade"}],"next":{"func":"blockAnimationSimpleEffectBy","values":[{"type":"choice","value":"ghost"},{"type":"number","value":"25"},{"type":"number","value":"1"},{"type":"string","value":""}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"fade"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleEffectTo"}

Animate Effect To

Perform an effect animation.

Parameters:

effect: The effect to perform.

value: The amount of the effect to perform to.

time: The time to perform the effect.

name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleEffectBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"fade"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Fall Die"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"fade"}],"next":{"func":"blockAnimationSimpleEffectTo","values":[{"type":"choice","value":"color"},{"type":"number","value":1},{"type":"number","value":"1"},{"type":"string","value":"fade"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"fade"}]}}}} Add to my Backpack