• No se han encontrado resultados

The following are the ATL statements. Interpolation Statement

interpolation_statement ->

( warper simple_expression | "warp" simple_expression simple_expression )?

( property simple_expression ( "knot" simple_expression )* | "clockwise"

| "counterclockwise"

| "circles" simple_expression | simple_expression )*

The interpolation statement is the main way that ATL controls transformations.

The first part of a the interpolation statement is used to select a a function that time-warps the interpolation. (That is, a function from linear time to non- linear time.) This can either be done by giving the name of a warper registered with ATL, or by giving the keyword "warp" followed by an expression giving a function. Either case is followed by a number, giving the number of seconds the the interpolation should take.

65

If no warp function is given, the interpolation is run for 0 seconds, using the pause function.

The warper and duration are used to compute a completion fraction. This is done by dividing the time taken by the interpolation by the duration of the interpolation. This is clamped to the duration, and then passed to the warper. The result returned by the warper is the completion fraction.

The interpolation statement can then contain a number of of other clauses. When a property and value are present, then the value is the value the property will obtain at the end of the statement. The value can be obtained in several ways:

 If the value is followed by one or two knots, then spline motion is used. The starting point is the value of the property at the start of the interpolation, the end point is the property value, and the knots are used to control the spline.

 If the interpolation statement contains a "clockwise" or

"counterclockwise" clause, circular motion is used, as described below.

 Otherwise, the value is linearly interpolated between the start and end locations, using the completion fraction.

The "clockwise", "counterclockwise", and "circle" clauses are used in circular motion, described below.

If a simple expression is present, it should evaluate to a transform with only a single interpolation statement, without a warper, splines, or circular motion. The properties from the transform are processes as if they were included in this statement.

Some sample interpolations are: show logo base:

# Show the logo at the upper right side of the screen. xalign 0.0 yalign 1.0

# Take 1.0 seconds to move things back to the left. linear 1.0 xalign 0.0

# Take 1.0 seconds to move things to the location specified in the

# truecenter transform. Use the ease warper to do this. ease 1.0 truecenter

# Just pause for a second. pause 1.0

# Set the location to circle around. alignaround (.5, .5)

66

# Use circular motion to bring us to spiral out to the top of # the screen. Take 2 seconds to do so.

linear 2.0 yalign 0.0 clockwise circles 3

# Use a spline motion to move us around the screen.

linear 2.0 align (0.5, 1.0) knot (0.0, .33) knot (1.0, .66) An important special case is that the pause warper, followed by a time and nothing else, causes ATL execution to pause for that amount of time. Some properties can have values of multiple types. For example, the xpos property can be an int, float, or absolute. The behavior is undefined when an interpolation has old and new property values of different types.

Time Statement

time_statement -> "time" simple_expression

The time statement is a simple control statement. It contains a single

simple_expression, which is evaluated to give a time, expressed as seconds from the start of execution of the containing block.

When the time given in the statement is reached, the following statement begins to execute.This transfer of control occurs even if a previous statement is still executing, and causes any prior statement to immediately terminate. Time statements are implicitly preceded by a pause statement with an infinite time. This means that if control would otherwise reach the time statement, it waits until the time statement would take control.

When there are multiple time statements in a block, they must strictly increase in order. image backgrounds: "bg band" time 2.0 "bg whitehouse" time 4.0 "bg washington" Expression Statement

expression_statement -> simple_expression ("with" simple_expression)? An expression statement is a simple statement that starts with a simple

expression. It then contains an optional with clause, with a second simple expression.

The first simple expression may evaluate to a transform (defined with the transform statement) or a displayable. If it's a transform, that transform is executed. With clauses are ignored when a transform is supplied.

67

The first simple expression may evaluate to an integer or floating point

number. In that case, it's taken as a number of seconds to pause execution for. Otherwise, the expression is interpreted to be a displayable. This displayable replaces the child of the transform when this clause executes, making it useful for animation. If a with clause is present, the second expression is evaluated as a transition, and the transition is applied to the old and new displayables. image atl example:

# Display logo_base.png "logo_base.png"

# Pause for 1.0 seconds. 1.0

# Show logo_bw.png, with a dissolve.

"logo_bw.png" with Dissolve(0.5, alpha=True) # Run the move_right tranform.

move_right Pass Statement

pass_statement -> "pass"

The pass statement is a simple statement that causes nothing to happen. This can be used when there's a desire to separate statements, like when there are two sets of choice statements that would otherwise be back-to-back.

Repeat Statement

repeat_statement -> "repeat" (simple_expression)?

The repeat statement is a simple statement that causes the block containing it to resume execution from the beginning. If the expression is present, then it is evaluated to give an integer number of times the block will execute. (So a block ending with "repeat 2" will execute at most twice.)

The repeat statement must be the last statement in a block. show logo base:

xalign 0.0 linear 1.0 xalign 1.0 linear 1.0 xalign 0.0 repeat Block Statement block_statement -> "block" ":" atl_block

The block statement is a complex statement that contains a block of ATL code. This can be used to group statements that will repeat.

68

alpha 0.0 xalign 0.0 yalign 0.0 linear 1.0 alpha 1.0 block: linear 1.0 xalign 1.0 linear 1.0 xalign 0.0 repeat Choice Statement

choice_statement -> "choice" (simple_expression)? ":" atl_block

The choice statement is a complex statement that defines one of a set of potential choices. Ren'Py will pick one of the choices in the set, and execute the ATL block associated with it, and then continue execution after the last choice in the choice set.

Choice statements are greedily grouped into a choice set when more than one choice statement appears consecutively in a block. If the simple_expression is supplied, it is a floating-point weight given to that block, otherwise 1.0 is assumed.

image eileen random: choice: "eileen happy" choice: "eileen vhappy" choice: "eileen concerned" pause 1.0 repeat Parallel Statement

The parallel statement is used to define a set of ATL blocks to execute in parallel.

parallel_statement -> "parallel" ":" atl_block

Parallel statements are greedily grouped into a parallel set when more than one parallel statement appears consecutively in a block. The blocks of all parallel statements are then executed simultaneously. The parallel statement terminates when the last block terminates.

The blocks within a set should be independent of each other, and manipulate different properties. When two blocks change the same property, the result is undefined.

show logo base: parallel:

69

xalign 0.0 linear 1.3 xalign 1.0 linear 1.3 xalign 0.0 repeat parallel: yalign 0.0 linear 1.6 yalign 1.0 linear 1.6 yalign 0.0 repeat Event Statement

event_prod_statement -> "event" name

The event statement is a simple statement that causes an event with the given name to be produced.

When an event is produced inside a block, the block is checked to see if an event handler for the given name exists. If it does, control is transferred to the event handler. Otherwise, the event propagates to any containing event

handler. On Statement

The On statement is a complex statement that defines an event handler. On statements are greedily grouped into a single statement.

on_statement -> "on" name ":" atl_block

The on statement is used to handle events. When an event is handled, handling of any other event ends and handing of the new event immediately starts. When an event handler ends without another event occuring, the "default" event is produced (unless were already handing the "default" event).

Execution of the on statement will never naturally end. (But it can be ended by the time statement, or an enclosing event handler.)

show logo base: on show: alpha 0.0 linear .5 alpha 1.0 on hide: linear .5 alpha 0.0 Contains Statement

The contains statement sets the displayable contained by this ATL transform. (The child of the transform.) There are two variants of the contains statement.

70

Documento similar