Path: blob/trunk/third_party/closure/goog/fx/css3/fx.js
2868 views
// Copyright 2011 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview A collection of CSS3 targeted animation, based on16* {@code goog.fx.css3.Transition}.17*18* @author [email protected] (Chris Henry)19*/2021goog.provide('goog.fx.css3');2223goog.require('goog.fx.css3.Transition');242526/**27* Creates a transition to fade the element.28* @param {Element} element The element to fade.29* @param {number} duration Duration in seconds.30* @param {string} timing The CSS3 timing function.31* @param {number} startOpacity Starting opacity.32* @param {number} endOpacity Ending opacity.33* @return {!goog.fx.css3.Transition} The transition object.34*/35goog.fx.css3.fade = function(36element, duration, timing, startOpacity, endOpacity) {37return new goog.fx.css3.Transition(38element, duration, {'opacity': startOpacity}, {'opacity': endOpacity},39{property: 'opacity', duration: duration, timing: timing, delay: 0});40};414243/**44* Creates a transition to fade in the element.45* @param {Element} element The element to fade in.46* @param {number} duration Duration in seconds.47* @return {!goog.fx.css3.Transition} The transition object.48*/49goog.fx.css3.fadeIn = function(element, duration) {50return goog.fx.css3.fade(element, duration, 'ease-out', 0, 1);51};525354/**55* Creates a transition to fade out the element.56* @param {Element} element The element to fade out.57* @param {number} duration Duration in seconds.58* @return {!goog.fx.css3.Transition} The transition object.59*/60goog.fx.css3.fadeOut = function(element, duration) {61return goog.fx.css3.fade(element, duration, 'ease-in', 1, 0);62};636465