Hello guest! Login or Register
Construct 2 r90

Released Friday, May 11, 2012 at 2:01:09 PM

28mb for Windows XP, Vista & 7

Free Download
Download Manual

Coming Soon

Sine behavior


The Sine behavior can adjust an object's properties (like its position, size or angle) back and forth according to an oscillating sine wave. This can be used to create interesting visual effects. Despite the name, alternative wave functions like 'Triangle' can also be selected to create different effects. A visualisation of the different wave types can be found on Wikipedia.

For examples of the Sine behavior's different modes, see Sine behavior - types.capx in the Examples folder in Construct 2's install directory.

Sine properties


Active on start
If No, the behavior will have no effect until the Set active action is used.

Movement
The Sine behavior has eight different modes:
Horizontal moves the object left and right on the X axis
Vertical moves the object up and down on the Y axis
Size makes the object grow and shrink
Width stretches the object wider and narrower
Height stretches the object taller and shorter
Angle rotates the object clockwise and anticlockwise
Opacity oscillates the object opacity. Note object opacities can never go less than 0 or greater than 100.
Value only does not modify the object. It simply stores the oscillating value which can be accessed by the Value expression. This can be useful to create custom effects or modify any other object or behavior property based on the sine behavior.

Wave
The wave function used to calculate the movement. For a visualisation see this Wikipedia diagram.
Sine - the default smooth oscillating motion based on a sine wave.
Triangle - a linear back-and-forth motion.
Sawtooth - linear motion with a jump back to start.
Reverse sawtooth - reverse linear motion with a jump back to start.
Square - alternating between the two maximum values.

Period
The duration, in seconds, of one complete back-and-forth cycle.

Period random
A random number of seconds added to the period for each instance. This can help vary the appearance when a lot of instances are using the Sine behavior.

Period offset
The initial time in seconds through the cycle. For example, if the period is 2 seconds and the period offset is 1 second, the sine behavior starts half way through a cycle.

Period offset random
A random number of seconds added to the period offset for each instance. This can help vary the appearance when a lot of instances are using the Sine behavior.

Magnitude
The maximum change in the object's position, size or angle. This is in pixels for position or size modes, or degrees for the angle mode.

Magnitude random
A random value to add to the magnitude for each instance. This can help vary the appearance when a lot of instances are using the Sine behavior.

Sine conditions


Compare magnitude
Compare the current magnitude of the movement.

Compare movement
Compare the current movement property of the behavior.

Compare period
Compare the current period of the movement, in seconds.

Compare wave
Compare the current wave property of the behavior.

Is active
True if the behavior is active.

Sine actions


Set active
Enable or disable the behavior. When disabled, the behavior does not affect the object at all.

Set magnitude
Set the current magnitude of the cycle. This is in pixels when modifying the size or position, and degrees when modifying the angle.

Set movement
Change the movement type of the behavior, e.g. from Horizontal to Size.

Set period
Set the duration of a single complete back-and-forth cycle, in seconds.

Set wave
Change the wave property of the behavior, choosing a different wave function to be used to calculate the movement.

Sine expressions


CyclePosition
Return a value from 0 to 1 representing the progress through the current cycle. For example, exactly half way through a cycle this returns 0.5.

Magnitude
Return the current magnitude of the cycle. This is in pixels when modifying the size or position, and degrees when modifying the angle.

Period
Return the current period of a single complete back-and-forth cycle in seconds.

Value
Return the current oscillating value. This will alternate as a positive and negative value centered on zero. This is useful to create custom effects when in Value only mode.

Previous Entry
Scroll to
Next Entry
Solid

Feedback on this page
How useful was this page for you?
Do you have any suggestions for this page?