SimpleFX Examples.
when(muteMode) ==> { // When in muteMode, define the invariants for rotation and scaling. Δ(guitarAngleX) <-- (Δ(pin.dragDistance.y + pin.touchScrollDistance.y)/ 3) // Angle-changes === the changes Δ(guitarAngleY) <-- (Δ(pin.dragDistance.x + pin.touchScrollDistance.x)/-3) // of the drag- and scroll-distances. Δ(guitarAngleZ) <-- Δ(pin.rotateAngleSum) // Angle-change === rotation-change. guitar.scaleXYZ <-- (prev(guitar.scaleX) * // Defining the scaling parameters. (1.0 + (Δ(pin.mouseWheelDistance.y) / 400)) * guitar.zoomFactorProduct / prev(guitar.zoomFactorProduct)).to3D when(guitar.scaleX < .25) --> { // When scale goes below 25%, reset. muteMode = false // Muting is set to off. guitarAngleXYZ := (0,0,0) in GUITAR_RESET_DURATION // Any rotation is reset, progressively. guitar.scaleXYZ := 1.0.to3D in GUITAR_RESET_DURATION // Any scaling is reset, progressively. } }
muteMode
, the 3-dimensional angles are to be changed through the dragDistance
's, the touchScrollDistance
's or the rotateAngle
. The dragDistance
's are defined through standard mouse-dragging-operations, the touchScrollDistance
's through standard touch-screen-operations and
the rotateAngleSum
through standard, multi-touch rotation operations. And,==>
), brief explanation: when(condition) ==> { body }
condition
changes from false
to true
, the body
is executed.condition
changes from true to false
, the body
is "cleaned up".body
are automatically disposed.condition
always results in an "undo" of whatever
happened in the last body
as the condition
was true
. And, whatever is defined in the body
. it can be regarded as an invariant for condition
being true
. How and when the condition
turned true
does not matter.
-->
), brief explanation:Bindable --> { expression }
expression
is being executed. The initial execution takes place at declaration-time. It works in many senses very similar to the Imply-Operator, but is simpler (see SimpleFX Tutorials for a precise definition).<--
), brief explanation:Bindable <-- { expression }
Bindable
is a SimpleFX Property. Any time when a Bindable, which is used inside of expression
, changes, the expression
is re-calculated and returns a new value for Bindable
. SimpleFX auto-detects all the Bindables being used inside of expression
and guarantuees a performant "monitoring" of any change happening to any of them. As the Binding is declared, the first, initial value of expression
is calculated and used to set the initial value of Bindable
. Therefore, expression
can be considered an invariant definition of Bindable
's value.
Δ(Bindable) <-- Δ(expression)
prev(Bindable)
represents the last Δ-value of Bindable. muteMode
. Any change to the dragging-properties, scroll-distances and rotate-angles should ONLY apply, as long as the guitar is in muteMode
(otherwise, we would have unwanted effects, like the guitar would rotate as we were playing, for instance.=
with <--
and you have a Binding instead of an assignment! And, secondly, in combination with the Delta (Δ), the zoom- and rotate-events can be defined in one single expression>
Bindable := value in duration
Bindable
is set to value
during a period of duration
. This means, Bindable
is interpolated, during a period of duration
and reaching the end-value of value
at the end of the duration
. Specific Interpolators, a startValue and an onFinished-Lamda are also supported.
package samples.hello import simplefx.core._ import simplefx.all._ object HelloSimpleFX extends SimpleFXApp { root = new Label(""" Hello all UI-Developer-Colleagues, Scala-Enthusiasts, Java-Enthusiasts, JavaFX-Fans, ScalaFX-Fans, Visage-Fans, all Fans of a little bit more Functional than Java, all Fans of creative DSLs, friends of Declarative- and Reactive Programming, all friends of short, precise, expressive, concise and non-verbose code! We are getting very close to the launch of SimpleFX! ... In the meantime, have fun studying the Samples and the different infos available! Stay in! And, please revisit this blog the next coming days ... We really hope you will learn to love it as much as we do! """) }