Difference between revisions of "Script:Animation"
From Roll20 Wiki
(Add page for Animation script) |
(Update docs for v0.2) |
||
Line 2: | Line 2: | ||
|name=Animation | |name=Animation | ||
|author={{user profile|503018|manveti}} | |author={{user profile|503018|manveti}} | ||
− | |version=0. | + | |version=0.2 |
− | |lastmodified=2015-06- | + | |lastmodified=2015-06-19}} |
'''Animation''' allows the user to define and run animations consisting of images from a Roll20 user library. Each frame's duration, position, and orientation can be set independently of the other frames, as can aura and light properties. | '''Animation''' allows the user to define and run animations consisting of images from a Roll20 user library. Each frame's duration, position, and orientation can be set independently of the other frames, as can aura and light properties. | ||
Line 15: | Line 15: | ||
{{API command|anim}} add {{API parameter|name=type}} {{API parameter|name=parameters}} {{API parameter|name=options|optional=true}}<br> | {{API command|anim}} add {{API parameter|name=type}} {{API parameter|name=parameters}} {{API parameter|name=options|optional=true}}<br> | ||
{{API command|anim}} edit {{API parameter|name=type}} {{API parameter|name=parameters}} {{API parameter|name=options|optional=true}}<br> | {{API command|anim}} edit {{API parameter|name=type}} {{API parameter|name=parameters}} {{API parameter|name=options|optional=true}}<br> | ||
+ | {{API command|anim}} rename {{API parameter|name=type}} {{API parameter|name=parameters}}<br> | ||
+ | {{API command|anim}} copy {{API parameter|name=type}} {{API parameter|name=parameters}}<br> | ||
{{API command|anim}} remove {{API parameter|name=type}} {{API parameter|name=parameters}}<br> | {{API command|anim}} remove {{API parameter|name=type}} {{API parameter|name=parameters}}<br> | ||
{{API command|anim}} list {{API parameter|name=type}} {{API parameter|name=parameters}}<br> | {{API command|anim}} list {{API parameter|name=type}} {{API parameter|name=parameters}}<br> | ||
Line 23: | Line 25: | ||
{{token|command}} {{rarr}} add<br> | {{token|command}} {{rarr}} add<br> | ||
{{token|command}} {{rarr}} edit<br> | {{token|command}} {{rarr}} edit<br> | ||
+ | {{token|command}} {{rarr}} rename<br> | ||
+ | {{token|command}} {{rarr}} copy<br> | ||
{{token|command}} {{rarr}} remove<br> | {{token|command}} {{rarr}} remove<br> | ||
{{token|command}} {{rarr}} list<br> | {{token|command}} {{rarr}} list<br> | ||
Line 37: | Line 41: | ||
{{param description top}} | {{param description top}} | ||
− | {{param description|name=command|value=Command (add, edit, remove, list, or run) for which to display command-specific help.}} | + | {{param description|name=command|value=Command (add, edit, rename, copy, remove, list, or run) for which to display command-specific help.}} |
{{param description|name=type|value=One of the following values: | {{param description|name=type|value=One of the following values: | ||
* '''image''': An image named for later use. | * '''image''': An image named for later use. | ||
Line 45: | Line 49: | ||
:!anim add image <''name''> [''url''] | :!anim add image <''name''> [''url''] | ||
:!anim edit image <''name''> <''url''> | :!anim edit image <''name''> <''url''> | ||
+ | :!anim rename image <''name''> <''newname''> | ||
:!anim remove image <''name''> | :!anim remove image <''name''> | ||
:!anim list image [''name''] | :!anim list image [''name''] | ||
::* ''name'': Name of image to affect. | ::* ''name'': Name of image to affect. | ||
::* ''url'': URL of image to give specified name (if no URL is provided, the image for the selected token will be used). | ::* ''url'': URL of image to give specified name (if no URL is provided, the image for the selected token will be used). | ||
+ | ::* ''newname'': New name of renamed image. | ||
:!anim add animation <''name''> [''cycles''] | :!anim add animation <''name''> [''cycles''] | ||
:!anim edit animation <''name''> <''cycles''> | :!anim edit animation <''name''> <''cycles''> | ||
+ | :!anim rename animation <''name''> <''newname''> | ||
+ | :!anim copy animation <''name''> <''newname''> | ||
:!anim remove animation <''name''> | :!anim remove animation <''name''> | ||
:!anim list animation [''name''] | :!anim list animation [''name''] | ||
::* ''name'': Name of animation to affect. | ::* ''name'': Name of animation to affect. | ||
::* ''cycles'': How many times to run through the animation's frames when it is played (default: 1). | ::* ''cycles'': How many times to run through the animation's frames when it is played (default: 1). | ||
+ | ::* ''newname'': New name of renamed or copied animation. | ||
:!anim add frame <''animation''> <''image''> <''duration''> [''options''] | :!anim add frame <''animation''> <''image''> <''duration''> [''options''] | ||
:!anim edit frame <''animation''> <''frame index''> [''options''] | :!anim edit frame <''animation''> <''frame index''> [''options''] | ||
+ | :!anim copy frame <''src animation''> <''src index''> <''dest animation''> [''dest index''] | ||
:!anim remove frame <''animation''> <''frame index''> | :!anim remove frame <''animation''> <''frame index''> | ||
:!anim list frame <''animation''> [''frame index''] | :!anim list frame <''animation''> [''frame index''] | ||
Line 63: | Line 73: | ||
::* ''duration'': Amount of time (in milliseconds) to display the new frame when the animation is played. | ::* ''duration'': Amount of time (in milliseconds) to display the new frame when the animation is played. | ||
::* ''frame index'': 0-based index of frame to affect. | ::* ''frame index'': 0-based index of frame to affect. | ||
+ | ::* ''src animation'': Name of animation from which to copy frame. | ||
+ | ::* ''src index'': 0-based index of frame to copy. | ||
+ | ::* ''dest animation'': Name of animation into which to copy frame. | ||
+ | ::* ''dest index'': 0-based index at which to insert copied frame (after last frame if not provided). | ||
:!anim run <''name''> [''options''] | :!anim run <''name''> [''options''] | ||
::* ''name'': Name of animation to play.}} | ::* ''name'': Name of animation to play.}} | ||
Line 131: | Line 145: | ||
=== Changelog === | === Changelog === | ||
+ | {{changelog version|0.2|2015-06-19|* Added rename and copy commands. Added output for all commands.}} | ||
{{changelog version|0.1|2015-06-16|* Initial release}} | {{changelog version|0.1|2015-06-16|* Initial release}} |
Revision as of 23:59, 19 June 2015
Version: 0.2
Last Modified: 2015-06-19
Code: Animation
Dependencies: None
Conflicts: None
Animation allows the user to define and run animations consisting of images from a Roll20 user library. Each frame's duration, position, and orientation can be set independently of the other frames, as can aura and light properties.
It is recommended that this script be used in conjunction with the CommandShell module, which will improve output formatting and command discovery.
Syntax
!anim help [command]
!anim add <type> <parameters> [options]
!anim edit <type> <parameters> [options]
!anim rename <type> <parameters>
!anim copy <type> <parameters>
!anim remove <type> <parameters>
!anim list <type> <parameters>
!anim run <name> [options]
Formally:
S
→ animcommand
arguments
command
→ help
command
→ add
command
→ edit
command
→ rename
command
→ copy
command
→ remove
command
→ list
command
→ run
arguments
→ ε
arguments
→ stringarguments
arguments
→option
arguments
option
→ -string
option
→ --string
option
→ -string string
option
→ --string string
Parameter | Values |
---|---|
command | Command (add, edit, rename, copy, remove, list, or run) for which to display command-specific help. |
type | One of the following values:
|
parameters | Each subcommand can accept (and generally requires) further parameters:
|
options | !anim add frame and !anim edit frame accept the following options:
|
Examples
- !anim add image HighDensityFire
- With a token selected, will name the token's image "HighDensityFire" for later reference.
- !anim add animation Fireball
- Will create an empty animation named "Fireball"
- !anim add frame Fireball HighDensityFire 50 -w 35 -h 35 --light 10 -dim 5
- Will create a 35x35 (half-square) frame using the "HighDensityFire" image. The frame will last for 50ms (1/20th of a second), and will emit 5 feet (1 square) of bright light and 5 further feet of dim light.
- !anim add frame Fireball --copy 0 --rotation 10 -w 70 -h 70 -l 20 -d 10
- Will create a 70x70 (full-square) frame using the first frame as a template. The new frame will be rotated 10 degrees clockwise, and will have both its size and light radius doubled.
- !anim add frame Fireball -C -1 -I MidDensityFire -r 20 -w 140 -h 140 -l 40 -d 20
- Will create another, larger frame, using the second frame as a template. This one will use a different image, will be rotated a further 10 degrees clockwise, and will have both its size and light radius doubled again.
- !anim edit frame Fireball 2 -I HighDensityFire
- If we decide the third frame was too early to switch to the "MidDensityFire" image, this command will change its image to "HighDensityFire".
- !anim edit HighDensityFire http://...
- Will change the "HighDensityFire" image to the new image. Note that this will not affect existing frames using the "HighDensityFire" image; they will continue to use whatever that name pointed at when they were defined.
- !anim remove frame Fireball 17
- Remove the 18th frame of the "Fireball" animation.
- !anim list image
- Will whisper a list of currently defined images, in alphabetical order, to the user who executed the command.
- !anim list image HighDensityFire
- Will whisper the URL of "HighDensityFire" to the user who executed the command, displaying the image in the whisper.
- !anim list animation
- Will whisper a list of currently defined animations, in alphabetical order, to the user who executed the command.
- !anim list animation Spinner
- Will whisper information about the specified animation to the user who executed the command.
- !anim list frame Fireball
- Will whisper a list of frames in the "Fireball" animation to the user who executed the command.
- !anim list frame Fireball 0
- Will whisper all the properties of the first frame of "Fireball" to the user who executed the command
- !anim run Fireball
- With a token selected, will run the "Fireball" animation centered on the selected token.
- !anim run Fireball -f 5 -x 500 -y 350 --xscale 2 --yscale 2
- Will run the "Fireball" animation centered at (500,350), doubled in size and running in slow-motion (taking five times as long to run).
Changelog
v0.2 (2015-06-19)
- Added rename and copy commands. Added output for all commands.
v0.1 (2015-06-16)
- Initial release