Package: | Ext |
Class: | Fx |
Extends: | Object |
Defined In: | Fx.js |
A class to provide basic animation and visual effects support. Note: This class is automatically applied to the Ext.Element interface when included, so all effects calls should be performed via Element. Conversely, since the effects are not actually defined in Element, Ext.Fx must be included in order for the Element effects to work.
It is important to note that although the Fx methods and many non-Fx Element methods support "method chaining" in that they return the Element object itself as the method return value, it is not always possible to mix the two in a single method chain. The Fx methods use an internal effects queue so that each effect can be properly timed and sequenced. Non-Fx methods, on the other hand, have no such internal queueing and will always execute immediately. For this reason, while it may be possible to mix certain Fx and non-Fx method calls in a single chain, it may not always provide the expected results and should be done with care.
Motion effects support 8-way anchoring, meaning that you can choose one of 8 different anchor points on the Element that will serve as either the start or end point of the animation. Following are all of the supported anchor positions:
Value Description ----- ----------------------------- tl The top left corner t The center of the top edge tr The top right corner l The center of the left edge r The center of the right edge bl The bottom left corner b The center of the bottom edge br The bottom right cornerAlthough some Fx methods accept specific custom config parameters, the ones shown in the Config Options section below are common options that can be passed to any Fx method.
方法 | 定义对象 | |
---|---|---|
fadeIn([Object options ]) : Element |
Fx | |
Fade an element in (from transparent to opaque). The ending opacity can be specified using the "endOpacity" config o... | ||
fadeOut([Object options ]) : Element |
Fx | |
Fade an element out (from opaque to transparent). The ending opacity can be specified using the "endOpacity" config ... | ||
frame([String color ], [Number count ], [Object options ]) : Element |
Fx | |
Shows a ripple of exploding, attenuating borders to draw attention to an Element. Usage: // default: a single light ... | ||
ghost([String anchor ], [Object options ]) : Element |
Fx | |
Slides the element while fading it out of view. An anchor point can be optionally passed to set the ending point of... | ||
hasActiveFx() : Boolean | Fx | |
Returns true if the element has any effects actively running or queued, else returns false. | ||
hasFxBlock() : Boolean | Fx | |
Returns true if the element is currently blocking so that no other effect can be queued until this effect is finished... | ||
highlight([String color ], [Object options ]) : Element |
Fx | |
Highlights the Element by setting a color (applies to the background-color by default, but can be changed using the "... | ||
pause(Number seconds ) : Element |
Fx | |
Creates a pause before any subsequent queued effects begin. If there are no effects queued after the pause it will h... | ||
puff([Object options ]) : Element |
Fx | |
Fades the element out while slowly expanding it in all directions. When the effect is completed, the element will b... | ||
scale(Number width , Number height , [Object options ]) : Element |
Fx | |
Animates the transition of an element's dimensions from a starting height/width to an ending height/width. Usage: //... | ||
sequenceFx() : Element | Fx | |
Ensures that all effects queued after sequenceFx is called on the element are run in sequence. This is the opposite ... | ||
shift(Object options ) : Element |
Fx | |
Animates the transition of any combination of an element's dimensions, xy position and/or opacity. Any of these prope... | ||
slideIn([String anchor ], [Object options ]) : Element |
Fx | |
Slides the element into view. An anchor point can be optionally passed to set the point of origin for the slide effe... | ||
slideOut([String anchor ], [Object options ]) : Element |
Fx | |
Slides the element out of view. An anchor point can be optionally passed to set the end point for the slide effect. ... | ||
stopFx() : Element | Fx | |
Stops any running effects and clears the element's internal effects queue if it contains any additional effects that ... | ||
switchOff([Object options ]) : Element |
Fx | |
Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television). Whe... | ||
syncFx() : Element | Fx | |
Ensures that all effects queued after syncFx is called on the element are run concurrently. This is the opposite of ... |
设置选项 | 定义对象 | |
---|---|---|
afterCls : String | Fx | |
A css class to apply after the effect | ||
afterStyle : String/Object/Function | Fx | |
A style specification string eg "width:100px", or object in the form {width:"100px"}, or a function which returns suc... | ||
block : Boolean | Fx | |
Whether the effect should block other effects from queueing while it runs | ||
callback : Function | Fx | |
A function called when the effect is finished | ||
concurrent : Boolean | Fx | |
Whether to allow subsequently-queued effects to run at the same time as the current effect, or to ensure that they ru... | ||
duration : Number | Fx | |
The length of time (in seconds) that the effect should last | ||
easing : String | Fx | |
A valid Easing value for the effect | ||
remove : Boolean | Fx | |
Whether the Element should be removed from the DOM and destroyed after the effect finishes | ||
scope : Object | Fx | |
The scope of the effect function | ||
stopFx : Boolean | Fx | |
Whether subsequent effects should be stopped and removed after the current effect finishes | ||
useDisplay : Boolean | Fx | |
Whether to use the display style attribute instead of visibility when hiding Elements (only applies to effects that e... |
public function fadeIn([Object options
])
// default: fade in from opactiy 0 to 100%
el.fadeIn();
// custom: fade in from opcaity 0 to 75% over 2 seconds
el.fadeIn({ endOpacity: .75, duration: 2});
// common config options shown with default values
el.fadeIn({
endOpacity: 1, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: .5
});
options
: ObjectElement
public function fadeOut([Object options
])
// default: fade out from the element's current opacity to 0
el.fadeOut();
// custom: fade out from the element's current opacity to 25% over 2 seconds
el.fadeOut({ endOpacity: .25, duration: 2});
// common config options shown with default values
el.fadeOut({
endOpacity: 0, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: .5
remove: false,
useDisplay: false
});
options
: ObjectElement
public function frame([String color
], [Number count
], [Object options
])
// default: a single light blue ripple
el.frame();
// custom: 3 red ripples lasting 3 seconds total
el.frame("ff0000", 3, { duration: 3 });
// common config options shown with default values
el.frame("C3DAF9", 1, {
duration: 1 //duration of entire animation (not each individual ripple)
// Note: Easing is not configurable and will be ignored if included
});
color
: Stringcount
: Numberoptions
: ObjectElement
public function ghost([String anchor
], [Object options
])
// default: slide the element downward while fading out
el.ghost();
// custom: slide the element out to the right with a 2-second duration
el.ghost('r', { duration: 2 });
// common config options shown with default values
el.ghost('b', {
easing: 'easeOut',
duration: .5
remove: false,
useDisplay: false
});
anchor
: Stringoptions
: ObjectElement
public function hasActiveFx()
Boolean
public function hasFxBlock()
Boolean
public function highlight([String color
], [Object options
])
// default: highlight background to yellow
el.highlight();
// custom: highlight foreground text to blue for 2 seconds
el.highlight("0000ff", { attr: 'color', duration: 2 });
// common config options shown with default values
el.highlight("ffff9c", {
attr: "background-color", //can be any valid css attribute that supports a color value
endColor: (current color) or "ffffff",
easing: 'easeIn',
duration: 1
});
color
: Stringoptions
: ObjectElement
public function pause(Number seconds
)
el.pause(1);
seconds
: NumberElement
public function puff([Object options
])
// default
el.puff();
// common config options shown with default values
el.puff({
easing: 'easeOut',
duration: .5,
remove: false,
useDisplay: false
});
options
: ObjectElement
public function scale(Number width
, Number height
, [Object options
])
// change height and width to 100x100 pixels
el.scale(100, 100);
// common config options shown with default values. The height and width will default to
// the element's existing values if passed as null.
el.scale(
[element's width],
[element's height], {
easing: 'easeOut',
duration: .35
});
width
: Numberheight
: Numberoptions
: ObjectElement
public function sequenceFx()
Element
public function shift(Object options
)
// slide the element horizontally to x position 200 while changing the height and opacity
el.shift({ x: 200, height: 50, opacity: .8 });
// common config options shown with default values.
el.shift({
width: [element's width],
height: [element's height],
x: [element's x position],
y: [element's y position],
opacity: [element's opacity],
easing: 'easeOut',
duration: .35
});
options
: ObjectElement
public function slideIn([String anchor
], [Object options
])
// default: slide the element in from the top
el.slideIn();
// custom: slide the element in from the right with a 2-second duration
el.slideIn('r', { duration: 2 });
// common config options shown with default values
el.slideIn('t', {
easing: 'easeOut',
duration: .5
});
anchor
: Stringoptions
: ObjectElement
public function slideOut([String anchor
], [Object options
])
// default: slide the element out to the top
el.slideOut();
// custom: slide the element out to the right with a 2-second duration
el.slideOut('r', { duration: 2 });
// common config options shown with default values
el.slideOut('t', {
easing: 'easeOut',
duration: .5,
remove: false,
useDisplay: false
});
anchor
: Stringoptions
: ObjectElement
public function stopFx()
Element
public function switchOff([Object options
])
// default
el.switchOff();
// all config options shown with default values
el.switchOff({
easing: 'easeIn',
duration: .3,
remove: false,
useDisplay: false
});
options
: ObjectElement
public function syncFx()
Element
afterCls : String
afterStyle : String/Object/Function
block : Boolean
callback : Function
concurrent : Boolean
duration : Number
easing : String
remove : Boolean
scope : Object
stopFx : Boolean
useDisplay : Boolean