Class MovingForms

java.lang.Object
eu.bandm.music.top.SvgSource
eu.bandm.music.top.MovingForms

public class MovingForms extends SvgSource
Simple example application of tscore and svg generation which maked geometrical shapes wander over a browser screen.
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]
  
  • Field Details

    • TRACKNAME_pos

      public static final String TRACKNAME_pos
      Evident
      See Also:
    • TRACKNAME_form

      public static final String TRACKNAME_form
      Evident
      See Also:
    • TRACKNAME_size

      public static final String TRACKNAME_size
      Evident
      See Also:
    • TRACKNAME_color

      public static final String TRACKNAME_color
      Evident
      See Also:
    • TRACKNAME_alpha

      public static final String TRACKNAME_alpha
      Evident
      See Also:
    • parse_ipol

      final Translet.Parser<String> parse_ipol
      Parser for the interpolation indication. Occurs always wrapped in an OPT.
    • event2xpos

      final Map<Event,Integer> event2xpos
      Evident
    • event2ypos

      final Map<Event,Integer> event2ypos
      Evident
    • event2form

      final Map<Event,Integer> event2form
      Evident
    • event2size

      final Map<Event,Integer> event2size
      Evident
    • event2alpha

      final Map<Event,Integer> event2alpha
      Maps some events to the transparent value (called "alpha")
    • event2color

      final Map<Event,Color_rgb_8> event2color
      Evident
    • event2pos_ipol

      final Map<Event,String> event2pos_ipol
      Maps some events to the interpolation mode to apply to the position.
    • event2size_ipol

      final Map<Event,String> event2size_ipol
      Maps some events to the interpolation mode to apply to the size.
    • event2color_ipol

      final Map<Event,String> event2color_ipol
      Maps some events to the interpolation mode to apply to the color.
    • event2alpha_ipol

      final Map<Event,String> event2alpha_ipol
      Maps some events to the interpolation mode to apply to the transparency.
    • parse_pos

      final Translet.Parser<?> 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, see parse_ipol.
    • parse_form

      final Translet.Parser<?> 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

      final Translet.Parser<?> parse_size
      Parser for the size (non-negative integer), plus an optional interpolation sign, see parse_ipol.
    • parse_color

      final Translet.Parser<?> parse_color
      Parser for the color, as defined by Color_rgb_8.parser(String), plus an optional interpolation sign, see parse_ipol.
    • parse_alpha

      final Translet.Parser<?> parse_alpha
      Parser for the transparency, plus an optional interpolation sign, see parse_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 by MfMain 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.
      Overrides:
      update in class SvgSource
    • posString

      protected String posString(Event e)
      Deliver the target svg text of the form's position, in svg coordinates.
    • sizeString

      protected String sizeString(Event e)
      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

      protected String size2transformstring(int user)
      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

      protected String polyPoints(int n)
      Create a polygon with radius = 100 .
      Parameters:
      n - number of edges
    • convertVoice

      protected void convertVoice(Vox v)
      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 class SvgSource