HomeTutorialsDynamic Effects and Animation

Support for Dynamic Effects and Animation: Timers and Macros

Zeljko Obrenovic, TU/e Eindoven
Last modified: 31/08/2009

Table of Content

Active Regions Speed and Rotation Speed Properties

Active regions have two properties that can produce simple animated effects:

  • Speed, where you can specify the speed of objects (in pixles per second). The active region will then move in the direction of its current orientation.
  • Rotation speed, where you can specify the rotation of the object (in degrees per second).

The following two video illustrate how to set and use these two propoerties.

Video 1. Using the active region's "speed" property to create a simple simulation of driving a car. This example is also used in the active regions tutorial.

 

Video 2. Using the active region's "rotation speed" property to create a simple simulation of windmill. This example is also used in the installation tutorial (see also how to open this example in Sketchify).

Timers and Animation

Timers can update AMICO Sketchify variables so that the flow of time can be incorporated in a sketch. A timer has a cycle duration and time resolution, and associated variables that are updated by it. A timer can cycle more than once, or work as a “pulsar”, where a variable increases from its minimum value to its maximum value in the forward cycle, while it decreases in the backward cycle.

Timers are often essential when creating animation effects. For example, a timer may update the variable associated with the image path of an active region, hence changing the image shown in the active region. In a similar way, we can graphically transform an active region, changing, for example, its position, orientation, transparency or size. For example, we can define a timer with a cycle duration of 60 seconds and a resolution of one update per second to update the variable “orientation” from 0 to 360 degrees. This variable can be used to control the orientation of other active regions, simulating the handle of a clock, for instance. Figure 1 and Video 3 illustrate how a timer can be used to animate the motion of an active region across a sketched trajectory.

Figure 1. Animating motion of an active region across a sketched trajectory. First the trajectory over which the active region will move is defined, and then a timer is used to animate the motion of the active region across the trajectory.

a

 

Video 3. Timers and Animations (see also how to open this example in Sketchify).

 

To simplify the creation of timers for animation a shortcut is provided. More specifically, the designer can select the active region that he wants to animate, which will automatically create a timer, while the interface to this timer, shown in Figure 2b, allows specifying the relationship between the timer and selected region parameters.

 

Figure 2. Interface for setting the parameters of a timer (a). It is also possible to create an animation timer for a selected active region (b), in which case the region parameters and associated variables that are influenced by the timer can be specified.

a

a

(a)

(b)

Macros

A macro is a list of successive commands that is triggered by a single event (Figure 3 and Video 4). In this way, more complex actions can be created, without the need for more advanced end-user programming tools. Macros can include pauses in between actions, which facilitates the control of dynamic effects.

Figure 3. Interface for defining macros, i.e., lists of commands that need to be executed sequentially (a).

a

(a) Defining a sequence of commands

a

          (b) Specifying a macro that runs in response to a mouse click on an active region

a

(c) Specifying a macro that runs on sketch entry


Currently supported commands that can be used within a macro include:

  • The transition to another sketch,
  • Pausing the execution of the macro for a specified time,
  • Executing operations on variables, including updating variables, appending text to the current variable value, and incrementing the variable value (for numeric values only)
  • Starting and stopping timers,
  • Starting and stopping other macros,
  • Opening external programs or files, and
  • Save part of the sketch to an image file.

Video 4. Defining Sketchify macros (see also how to open this example in Sketchify).

Examples to Import from URL in Sketchify

You can open the examples from this tutorial in Sketchify by using "Import from URL" function (in the File menu), and copy-and-paste there the URL of an example.

To Probe Further