Slot Effect Jquery

  

Tags jquery, navigation, simple, slot machine, tutorial August 2, 2010 Navigation is one of the things you’ll see on every website. I wanted to give this part a little bit extra life, and when I saw a movie yesterday that included slot machines, it suddenly hit me. A very simple slot machine that show random numbers each time played. (Import jquery-easing and select easing effect here: link. This all started when I first wanted to make a slot machine video game and had some other ideas to try out as well. This is a code and information collection you can use to create various slot machine effects. Mostly, the idea is to provide different effects using HTML5, CSS3, and/or JQuery to produce the spinning wheel(s) and some other effects. Slot Machine Effect Jquery Mr Green: £100 bonus cash + 200 bonus spins Claim up to £100 on your first bonus + 200 spins on Starburst at Slot Machine Effect Jquery Mr Green when you register. Then claim a great deposit bonus + even more spins! Once the button is clicked I want to have the venues scroll through with a slot machine spinning animation using CSS3 and jQuery before a venue is selected. I thought about using -webkit-keyframes and changing the background position, but it's not the ideal animation I would like.

Reference for the Mosaic class Effects::Effect

Effect
Effects::Effect
Amplitude
Bounces
CycleDuration
Elasticity
Enabled
Exponent
InitialDelay
InterCycleDelay
NoOfCycles
Noise
OnAnimate
OnFinished
Oscillations
Reversed
Symmetric
Timing
TimingCustom1
TimingCustom2
ReverseEffect
StartEffect
StopEffect

SEE ALSO

The class Effects::Effect provides the base functionality for all kinds of animation effects. Effects allow the designer to enrich the GUI application with additional fancy and eye candy animations. For example, the effect Effects::ColorEffect performs the color fade animation. Effects::RectEffect in contrast can animate the position and the size of a GUI component, etc. Animation effects are determined by their duration and by the timing function.

The duration is primarily controlled by the value of the property CycleDuration. This is the time the effect will take for a single animation run. Whether and how often the animation is repeated is stored in the property NoOfCycles. In this case the property InterCycleDelay can determine an optional interval to wait between two consecutive animation runs. Finally the property InitialDelay determines the interval to wait at the very beginning of the effect still before the first animation run began.

The timing function determines the curve to run the animation. The class implements an extensive set of various timing functions. In its simplest case the animation can follow a straight line, or it can start slow and get faster afterwards. More complex timings perform realistic spring elastic and bounce animations. Besides it the user can configure his/her own animation curve. In such case the timing function is based on a cubic Bezier curve. It gives the designer a lot of possibilities to specify very fancy timing functions. The timing is controlled by the property Timing. In the case the designer wants to specify a new curve, the properties TimingCustom1 and TimingCustom2 are available. With the property Noise an additional random noise can be added to the effect.

Slot Effect Jquery Example

During the runtime of the animation, the effect will send signals to the slot method stored in the property OnAnimate. When the effect is finished a signal is send to the slot method stored in the OnFinished property.

Whether the effect is running or not is controlled by its property Enabled. It can be used to start and stop the effect. The effect can also be controlled by sending signals to its StartEffect and StopEffect slot methods. With the property Reversed the playback direction can be determined. This allows to simply rewind running effects or to configure an effect to be played in the reverse direction. The slot method ReverseEffect can also be used to switch the playback direction.

property float Amplitude = 0.5;

The property 'Amplitude' determines the magnitude of the retraction when Timing is configured with Effects::Timing.Back_In, Effects::Timing.Back_Out or Effects::Timing.Back_InOut.

The valid values for this property lie in the range 0.0 .. 10.0.

property int32 Bounces = 3;

Slot Effect Jquery Download

The property 'Bounces' determines how often the animation should bounce on its start or/and finish position when Timing is configured with Effects::Timing.Bounce_In, Effects::Timing.Bounce_Out or Effects::Timing.Bounce_InOut.

The valid values for this property lie in the range 1 .. 10.

property int32 CycleDuration = 1000;

The property 'CycleDuration' stores the period in milliseconds of a single animation run.

property float Elasticity = 0.5;

The property 'Elasticity' determines the amplitude of a bounce in relation to the just preceding bounce when Timing is configured with Effects::Timing.Bounce_In, Effects::Timing.Bounce_Out or Effects::Timing.Bounce_InOut.

The valid values for this property lie in the range 0.0 .. 1.0 whereby the value 1.0 means that the bounce is very elastic.

property bool Enabled = false;

The property 'Enabled' determines whether the effect is currently running or not. Changing the value of this property from 'false' to 'true' will re-start the effect. In such case the effect will start from the beginning.

The lifetime of the effect can also be controlled by sending signals to the slot methods StartEffect and StopEffect. Moreover with the property Reversed and the slot method ReverseEffect the playback direction can be controlled.

property float Exponent = 3.0;

The property 'Exponent' determines the exponent parameter if Timing is configured with Effects::Timing.Power_In, Effects::Timing.Power_Out, Effects::Timing.Power_InOut, Effects::Timing.Exp_In, Effects::Timing.Exp_Out, Effects::Timing.Exp_InOut.

The valid values for this property lie in the range 1.0 .. 100.0.

property int32 InitialDelay = 0;

The property 'InitialDelay' stores the interval in milliseconds the effect should wait before the first animation run can begin. If InitialDelay is zero the effect will start the animation immediately.

property int32 InterCycleDelay = 0;

The property 'InterCycleDelay' stores the interval in milliseconds the effect should wait between two consecutive animation runs. This value has no effect if the animation is not repeated (NoOfCycles 1) If InterCycleDelay is zero the effect will not wait between the animation runs.

property int32 NoOfCycles = 0;

The property 'NoOfCycles' determines how often the effect should repeat the animation. If this value is zero, the effect will run endless.

property float Noise = 0.0;

The property 'Noise' stores the magnitude of an additional random noise to apply on the resulting animation. Valid values for this property lie in range 0.0 .. 1.0.

property slot OnAnimate = null;

The property 'OnAnimate' can refer to a slot method, which should be invoked when the effect triggers the next animation frame. It's up to you to provide the slot method and to fill it with the desired behavior. From the method you can query the current progress of the animation. For this purpose derived classes provide a variable Value.

Usually, it is not necessary to implement any slot methods in order to perform the animation. All derived effect classes do provide an Outlet property, which can refer to the property which should be animated.

property slot OnFinished = null;

The property 'OnFinished' can refer to a slot method, which should be invoked when the effect is done. It's up to you to provide the slot method and to fill it with the desired behavior. It makes possible to chain effects together, so the finish of one effect can trigger another effect. To do this simply assign the StartEffect slot method of the one effect to the OnFinished property of the other effect.

property int32 Oscillations = 3;

The property 'Oscillations' determines how often the animation should oscillate back and forth around its start or/and finish position when Timing is configured with Effects::Timing.Elastic_In, Effects::Timing.Elastic_Out or Effects::Timing.Elastic_InOut.

Slot effect jquery examples

The valid values for this property lie in the range 1 .. 10.

slot ReverseEffect;

The slot method 'ReverseEffect' advises the running effect to reverse its current playback direction. If the signal is sent while the effect is not running (property Enabled false), nothing occurs.

property bool Reversed = false;

The property 'Reversed' controls the playback direction of the effect. If this property is 'false' the effect is played forward. If this property is 'true' the effect is played backward. You can change this property either while the effect is running or before the effect has been started:

  • Changing this property while the effect is running will cause the effect playback direction to be changed immediately. In this case all already traversed animation cycles are rewinded till the origin of the effect is reached. This includes all delays between the animation cycles as well as the initial delay specified in the properties InitialDelay and InterCycleDelay. Note, if the effect is endless (property NoOfCycles 0) then the effect will continue running endless with the reversed direction.
  • If this property is set 'true' before the effect has been started then the effect behaves as if it has been configured with Value1 and Value2 exchanged and the Timing function mirrored. In particular before the first animation cycle begins the effect waits the time specified in the property InitialDelay.

Please note, when the effect ends (regardless of its playback direction) a signal is sent to the slot method specified in the property OnFinished.

slot StartEffect;

The slot method 'StartEffect' re-starts the effect if a signal is sent to this slot method. The effect will start from the beginning.

slot StopEffect;

The slot method 'StopEffect' stops the running effect if a signal is sent to this slot method. This causes the animation to pause at its current position.

property bool Symmetric = false;

The property 'Symmetric' determines with which value should terminate an animation run. Usually, the animation starts with the value specified in the property Value1 and ends with the value from the property Value2. If Symmetric 'true', the animation starts and ends with the same value Value1. Value2 will be reached in the middle of the animation. Thus a single animation run seems as if it had been mirrored at its half-time.

property Effects::TimingTiming = Effects::Timing.Linear;

Slot Effect Jquery

The property 'Timing' determines the curve to interpolate the animated values during the animation:

  • Effects::Timing.Linear : the animation will follow a straight line. The values will be linearly interpolated.
  • Effects::Timing.Power_In : the animation starts slow and then accelerates using the power function f(t)=t^Exponent. The exponent is determined by the property Exponent. To achieve an effect like the jQuery 'easeInQuad', 'easeInCube', 'easeInQuart' and 'easeInQuint' set the Exponent to the corresponding value 2.0, 3.0, 4.0 or 5.0.
  • Effects::Timing.Power_Out : the animation starts fast and then decelerates using the power function f(t)=t^Exponent. The exponent is determined by the property Exponent. To achieve an effect like the jQuery 'easeOutQuad', 'easeOutCube', 'easeOutQuart' and 'easeOutQuint' set the Exponent to the corresponding value 2.0, 3.0, 4.0 or 5.0.
  • Effects::Timing.Power_InOut : the animation starts slow, accelerates and then decelerates again using the power function f(t)=t^Exponent. The exponent is determined by the property Exponent. To achieve an effect like the jQuery 'easeInOutQuad', 'easeInOutCube', 'easeInOutQuart' and 'easeInOutQuint' set the Exponent to the corresponding value 2.0, 3.0, 4.0 or 5.0.
  • Effects::Timing.Exp_In : the animation starts slow and then accelerates using the formula f(t)=(exp(Exponent*t)-1.0)/(exp(Exponent)-1.0). The exponent is determined by the property Exponent. To achieve an effect like the jQuery 'easeInExpo' set the Exponent to the value 7.0.
  • Effects::Timing.Exp_Out : the animation starts fast and then decelerates using the formula f(t)=(exp(Exponent*t)-1.0)/(exp(Exponent)-1.0). The exponent is determined by the property Exponent. To achieve an effect like the jQuery 'easeOutExpo' set the Exponent to the value 7.0.
  • Effects::Timing.Exp_InOut : the animation starts slow, accelerates and then decelerates again using the formula f(t)=(exp(Exponent*t)-1.0)/(exp(Exponent)-1.0). The exponent is determined by the property Exponent. To achieve an effect like the jQuery 'easeInOutExpo' set the Exponent to the value 7.0.
  • Effects::Timing.Sine_In : the animation starts slow and then accelerates using the sine function f(t)=sin(t*90).
  • Effects::Timing.Sine_Out : the animation starts fast and then decelerates using the sine function f(t)=sin(t*90).
  • Effects::Timing.Sine_InOut : the animation starts slow, accelerates and then decelerates again using the sine function f(t)=sin(t*90).
  • Effects::Timing.Circle_In : the animation starts slow and then accelerates using the circular function f(t)=1-sqrt(1-t^2).
  • Effects::Timing.Circle_Out : the animation starts fast and then decelerates using the circular function f(t)=1-sqrt(1-t^2).
  • Effects::Timing.Circle_InOut : the animation starts slow, accelerates and then decelerates again using the circular function f(t)=1-sqrt(1-t^2).
  • Effects::Timing.Back_In : at the begin the animation retracts slightly and then it accelerates again towards the finish. The amplitude of the retraction is determined by the property Amplitude. This timing is based on the formula f(t)=t^3-t*Amplitude*sin(t*180).
  • Effects::Timing.Back_Out : at the begin the animation decelerates again towards the finish and then swings slightly over the final position. The amplitude of the retraction at the final position is determined by the property Amplitude. This timing is based on the formula f(t)=t^3-t*Amplitude*sin(t*180).
  • Effects::Timing.Back_InOut : at the begin the animation retracts slightly and then it accelerates again. At the half time the animation decelerates and once reached the final position it swings slightly over it. The amplitude of the retractions at the start and the end position is determined by the property Amplitude. This timing is based on the formula f(t)=t^3-t*Amplitude*sin(t*180).
  • Effects::Timing.Elastic_In : similarly to a spring this animation oscillates back and forth around its start position increasing with every oscillation its amplitude. The total number of oscillations is determined by the property Oscillations. With the end of the last oscillation the animation reaches its final position. This timing is based on the formula f(t)=t^3*sin(t*90*(1+4*Oscillations)).
  • Effects::Timing.Elastic_Out : similarly to a spring this animation oscillates back and forth around its finish position decreasing with every oscillation its amplitude. The total number of oscillations is determined by the property Oscillations. With the end of the last oscillation the animation reaches its final position. This timing is based on the formula f(t)=t^3*sin(t*90*(1+4*Oscillations)).
  • Effects::Timing.Elastic_InOut : this animation oscillates back and forth around its start position increasing with every oscillation its amplitude. Then from the halftime the animation oscillates around its finish position decelerating again its amplitude with every oscillation. How often the animation oscillates around the start and finish position is determined by the property Oscillations. With the end of the last oscillation the animation reaches its final position. This timing is based on the formula f(t)=t^3*sin(t*90*(1+4*Oscillations)).
  • Effects::Timing.Bounce_In : this animation bounces on its start position increasing with every bounce its amplitude. The total number of bounces is determined by the property Bounces. How much the amplitude is increased is determined by the property Elasticity. With the end of the last bounce the animation reaches its final position.
  • Effects::Timing.Bounce_Out : this animation bounces on its finish position decreasing with every bounce its amplitude. The total number of bounces is determined by the property Bounces. How much the amplitude is decreased is determined by the property Elasticity. With the end of the last bounce the animation reaches its final position.
  • Effects::Timing.Bounce_InOut : this animation bounces on its start position increasing with every bounce its amplitude. Then from the halftime this animation bounces on its finish position decreasing again its amplitude with every bounce. How often the animation bounces on the start and on the finish position is determined by the property Bounces. How much the amplitude is increased/decreased is determined by the property Elasticity. With the end of the last bounce the animation reaches its final position.
  • Effects::Timing.EaseIn_FastOut : the animation starts slow and then accelerates. This mode corresponds to Effects::Timing.Power_In with property Exponent set to 3.0.
  • Effects::Timing.FastIn_EaseOut : the animation starts fast and then decelerates. This mode corresponds to Effects::Timing.Power_Out with property Exponent set to 3.0.
  • Effects::Timing.FastIn_FastOut : the animation starts fast, decelerates and then accelerates again.
  • Effects::Timing.EaseIn_EaseOut : the animation starts slow, accelerates and then decelerates again.
  • Effects::Timing.Custom : The animation curve is determined by properties TimingCustom1 and TimingCustom2.

property float TimingCustom1 = 0.0;

The property 'TimingCustom1' controls the animation speed at the beginning of a user-defined timing function. The timing functions are based on cubic Bezier curves. Coming from a curve with a constant slope (a straight line), this property determines whether the curve should turn left (positive value) or turns right (negative value) at its beginning.

To activate the user-defined timing function, the property Timing should be initialized with the value Effects::Timing.Custom.

property float TimingCustom2 = 0.0;

The property 'TimingCustom2' controls the animation speed at the end of a user-defined timing function. The timing functions are based on cubic Bezier curves. Coming from a curve with a constant slope (a straight line), this property determines whether the curve should turn right (positive value) or turns left (negative value) at its end.

To activate the user-defined timing function, the property Timing should be initialized with the value Effects::Timing.Custom.