Package eu.bandm.music.top
Class MovingForms
java.lang.Object
eu.bandm.music.top.SvgSource
eu.bandm.music.top.MovingForms
Simple example application of tscore and svg generation which maked geometrical
shapes wander over a browser screen.
The main example score is
The viewport will be defined when rendering x1, x2, y1, y2, size to (0..width) and (0..height).
All y-coordinates (in user space and in generated svg) grow downwards, as usual in svg, see See https://www.w3.org/TR/SVG11/coords.html#InitialCoordinateSystem
(For more info about "dynamic svg" see docu of superclass) The fundamental code generation scheme for one single moving form (circle or polygon) is:
The main example score is
sig/examples/tscore/simple.moving
.
The score format is as follows:
SCORE x PARS y T 0 20 1'20 2'10 VOX a 0,0/ 99,99 / 99,0 // main parameter is the position of the center of the figure, integer from 0 to 99 // rendering makes viewport interpretation, eg. 20--70 -> 0--1024 // tscoreCoord -> physCoord // "-" means: hold value until next explicit value (is default) // "/" means: start linear interpolation P form 3 // param form is 0(circle), 3(triangle) or 4(square) P size 3/ 5 10 // size is diameter/side length, same units as position P color 0,0,99/ 0,99,0-/ // color is integer RGB, 99 is full, 0 is not present P alpha 0-/ // alpha is transparency, 0 is opaque, 99 is invisible // all values are integer.The sequential source order of voices defines the (decreasing) visbility z-stacking.
The viewport will be defined when rendering x1, x2, y1, y2, size to (0..width) and (0..height).
All y-coordinates (in user space and in generated svg) grow downwards, as usual in svg, see See https://www.w3.org/TR/SVG11/coords.html#InitialCoordinateSystem
(For more info about "dynamic svg" see docu of superclass) The fundamental code generation scheme for one single moving form (circle or polygon) is:
[g] [circle r=".." transform="scale(..)" fill=".."] [set attributeType='XML' attributeName='opacity' to='1.0' begin='SWITCH_ON_TIME' /] [animateTransform attributeType='XML' attributeName='transform' type='scale' from=".." to=".." begin=".." dur=".." /] [/circle] [animateTransform attributeType='XML' attributeName='transform' type='translate' from=".." to=".." begin=".." dur=".." /] [/g] [g] [polygon r=".." points=".. .. .." transform="scale(..)" fill=".."] ... [/polygon] [/g]
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.bandm.music.top.SvgSource
SvgSource.ParamTranslate, SvgSource.Process
-
Field Summary
Modifier and TypeFieldDescriptionMaps some events to the transparent value (called "alpha")Maps some events to the interpolation mode to apply to the transparency.(package private) final Map<Event,
Color_rgb_8> EvidentMaps some events to the interpolation mode to apply to the color.EvidentMaps some events to the interpolation mode to apply to the position.EvidentMaps some events to the interpolation mode to apply to the size.EvidentEvident(package private) final Translet.Parser<?>
Parser for the transparency, plus an optional interpolation sign, seeparse_ipol
.(package private) final Translet.Parser<?>
Parser for the color, as defined byColor_rgb_8.parser(String)
, plus an optional interpolation sign, seeparse_ipol
.(package private) final Translet.Parser<?>
Parser for the geometric form.(package private) final Translet.Parser<String>
Parser for the interpolation indication.(package private) final Translet.Parser<?>
Parser for the main parameter value, which is x-pos and y-pos (both as non-negative integers) plus an optional interpolation sign, seeparse_ipol
.(package private) final Translet.Parser<?>
Parser for the size (non-negative integer), plus an optional interpolation sign, seeparse_ipol
.static final String
Evidentstatic final String
Evidentstatic final String
Evidentstatic final String
Evidentstatic final String
Evident -
Constructor Summary
ConstructorDescriptionMovingForms
(Part part, MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg) Only constructor for this tscore data processors, found and instantiated byMfMain
by reflection. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Must be overridden by the sub-class which realizes the specific conversion.protected void
convertVoice
(Vox v) Generate the complete svg/smil target text for one voice.protected String
polyPoints
(int n) Create a polygon with radius = 100 .protected String
Deliver the target svg text of the form's position, in svg coordinates.protected String
size2transformstring
(int user) Deliver the target svg text of the form's size, as a "scale()" svg command.protected String
sizeString
(Event e) Deliver the target svg text of the form's size.void
update()
Translate untyped tscore data into semantically sensible "MovingForm" data, and verify that all constraints are met.Methods inherited from class eu.bandm.music.top.SvgSource
alpha2string, animateString, animateString_tp, animateTransformString, check_init_def, color2string, convertToSvg, height2device, height2device, printAlpha, printColor, setString, tp2device, when2device, width2device, width2device, x2device, y2device
-
Field Details
-
TRACKNAME_pos
Evident- See Also:
-
TRACKNAME_form
Evident- See Also:
-
TRACKNAME_size
Evident- See Also:
-
TRACKNAME_color
Evident- See Also:
-
TRACKNAME_alpha
Evident- See Also:
-
parse_ipol
Parser for the interpolation indication. Occurs always wrapped in an OPT. -
event2xpos
Evident -
event2ypos
Evident -
event2form
Evident -
event2size
Evident -
event2alpha
Maps some events to the transparent value (called "alpha") -
event2color
Evident -
event2pos_ipol
Maps some events to the interpolation mode to apply to the position. -
event2size_ipol
Maps some events to the interpolation mode to apply to the size. -
event2color_ipol
Maps some events to the interpolation mode to apply to the color. -
event2alpha_ipol
Maps some events to the interpolation mode to apply to the transparency. -
parse_pos
Parser for the main parameter value, which is x-pos and y-pos (both as non-negative integers) plus an optional interpolation sign, seeparse_ipol
. -
parse_form
Parser for the geometric form. This may be the integer 0(zero) for a circle, or 3 to 8 for a polygon. (Is currently evaluated only once, with the very first event, -- changes of the form are not supported.) -
parse_size
Parser for the size (non-negative integer), plus an optional interpolation sign, seeparse_ipol
. -
parse_color
Parser for the color, as defined byColor_rgb_8.parser(String)
, plus an optional interpolation sign, seeparse_ipol
. -
parse_alpha
Parser for the transparency, plus an optional interpolation sign, seeparse_ipol
. Transparency is encoded from 0=totally transparent=invisible to 100=totally opaque.
-
-
Constructor Details
-
MovingForms
public MovingForms(Part part, MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg) Only constructor for this tscore data processors, found and instantiated byMfMain
by reflection.
-
-
Method Details
-
update
public void update()Translate untyped tscore data into semantically sensible "MovingForm" data, and verify that all constraints are met. This method reads the event lists contained in TimeScape->voices->bySourceOrder and writes to all the local Map and Set output data declared locally. -
posString
Deliver the target svg text of the form's position, in svg coordinates. -
sizeString
Deliver the target svg text of the form's size. The created drawing has a size of 100 physical units, so a factor of magnification is calculated accordingly. -
size2transformstring
Deliver the target svg text of the form's size, as a "scale()" svg command. The created drawing has a size of 100 physical units, so a factor of magnification is calculated accordingly. -
polyPoints
Create a polygon with radius = 100 .- Parameters:
n
- number of edges
-
convertVoice
Generate the complete svg/smil target text for one voice. One voice corresponds to one moving geometrical form, with number of edges, position, size, color, and opacity. -
convertData
protected void convertData()Must be overridden by the sub-class which realizes the specific conversion. This may use all parameters in local registers and the auxiliary write-out methods.. Here: convert one by one all tscore "voice" objects into an Svg/Smil source text.- Specified by:
convertData
in classSvgSource
-