Debian Codegraph @

tests/visual/effects/effects.js

raw symbols SCIP
1 var duration = 1000,
2 wait = 500;
3
4 function effect( elem, name, options ) {
5 $.extend( options, {
6 easing: "easeOutQuint"
7 } );
8
9 $( elem ).on( "click", function() {
10 $( this )
11 .addClass( "current" )
12
13 // delaying the initial animation makes sure that the queue stays in tact
14 .delay( 10 )
15 .hide( name, options, duration )
16 .delay( wait )
17 .show( name, options, duration, function() {
18 $( this ).removeClass( "current" );
19 } );
20 } );
21 }
22
23 $( "#hide" ).on( "click", function() {
24 $( this )
25 .addClass( "current" )
26 .hide( duration )
27 .delay( wait )
28 .show( duration, function() {
29 $( this ).removeClass( "current" );
30 } );
31 } );
32
33 effect( "#blindLeft", "blind", { direction: "left" } );
34 effect( "#blindUp", "blind", { direction: "up" } );
35 effect( "#blindRight", "blind", { direction: "right" } );
36 effect( "#blindDown", "blind", { direction: "down" } );
37
38 effect( "#bounce3times", "bounce", { times: 3 } );
39
40 effect( "#clipHorizontally", "clip", { direction: "horizontal" } );
41 effect( "#clipVertically", "clip", { direction: "vertical" } );
42
43 effect( "#dropDown", "drop", { direction: "down" } );
44 effect( "#dropUp", "drop", { direction: "up" } );
45 effect( "#dropLeft", "drop", { direction: "left" } );
46 effect( "#dropRight", "drop", { direction: "right" } );
47
48 effect( "#explode9", "explode", {} );
49 effect( "#explode36", "explode", { pieces: 36 } );
50
51 effect( "#fade", "fade", {} );
52
53 effect( "#fold", "fold", { size: 50 } );
54
55 effect( "#highlight", "highlight", {} );
56
57 effect( "#pulsate", "pulsate", { times: 2 } );
58
59 effect( "#puff", "puff", {} );
60 effect( "#scale", "scale", {} );
61 effect( "#size", "size", {} );
62 $( "#sizeToggle" ).on( "click", function() {
63 var options = { to: { width: 300, height: 300 } };
64 $( this )
65 .addClass( "current" )
66 .toggle( "size", options, duration )
67 .delay( wait )
68 .toggle( "size", options, duration, function() {
69 $( this ).removeClass( "current" );
70 } );
71 } );
72
73 $( "#shake" ).on( "click", function() {
74 $( this )
75 .addClass( "current" )
76 .effect( "shake", {}, 100, function() {
77 $( this ).removeClass( "current" );
78 } );
79 } );
80
81 effect( "#slideDown", "slide", { direction: "down" } );
82 effect( "#slideUp", "slide", { direction: "up" } );
83 effect( "#slideLeft", "slide", { direction: "left" } );
84 effect( "#slideRight", "slide", { direction: "right" } );
85
86 $( "#addClass" ).on( "click", function() {
87 $( this ).addClass( "current", duration, function() {
88 $( this ).removeClass( "current" );
89 } );
90 } );
91 $( "#removeClass" ).on( "click", function() {
92 $( this ).addClass( "current" ).removeClass( "current", duration );
93 } );
94 $( "#toggleClass" ).on( "click", function() {
95 $( this ).toggleClass( "current", duration );
96 } );