[API] animate()

2015. 7. 27. 13:00[개발] 지식/Jquery

.animate( properties [, duration ] [, easing ] [, complete ] )

    • properties
      An object of CSS properties and values that the animation will move toward.
    • duration (default: 400)
      Type: Number or String
      A string or number determining how long the animation will run.
    • easing (default: swing)
      Type: String
      A string indicating which easing function to use for the transition.
    • complete
      Type: Function()
      A function to call once the animation is complete.

version added: 1.0.animate( properties, options )

    • properties
      An object of CSS properties and values that the animation will move toward.
    • options
      A map of additional options to pass to the method.
      • duration (default: 400)
        Type: Number or String
        A string or number determining how long the animation will run.
      • easing (default: swing)
        Type: String
        A string indicating which easing function to use for the transition.
      • queue (default: true)
        Type: Boolean or String
        A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it.
      • specialEasing
        An object containing one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4)
      • step
        Type: FunctionNumber now, Tween tween )
        A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set.
      • progress
        Type: FunctionPromise animation, Number progress, Number remainingMs )
        A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8)
      • complete
        Type: Function()
        A function to call once the animation is complete.
      • start
        Type: FunctionPromise animation )
        A function to call when the animation begins. (version added: 1.8)
      • done
        Type: FunctionPromise animation, Boolean jumpedToEnd )
        A function to be called when the animation completes (its Promise object is resolved). (version added:1.8)
      • fail
        Type: FunctionPromise animation, Boolean jumpedToEnd )
        A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8)
      • always
        Type: FunctionPromise animation, Boolean jumpedToEnd )
        A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8)

<출처 : http://jquery.com/>


메서드의 기본형은 상기된 것과 같습니다.


첫번 째 형식에서

properties는 속성값으로써, left, top, width, height, fontSize, opacity 등의 값을 넣어줍니다. 
(이런 속성들의 리스트는 어디서 확인하는지?)
duration은 애니매이션의 지속시간을 나타내며 ms단위로 입력합니다.
easing은 .. http://jqueryui.com/easing/ 참고.. 애니메이션의 동작 형태를 설정한는 듯(탄성?).. 합니다.
complete는 콜백 함수를 넣어줍니다.(애니매이션이 끝나고 실행됨)


두 번째 형식에서

properties는 역시 움직임의 방향을 설정해줍니다.
option은 상기된 바와 같이 여러가지 속성값들을 넣어줄 수 있습니다. 위의 document 참고.

'[개발] 지식 > Jquery' 카테고리의 다른 글

find()와 children()의 작동원리  (0) 2016.11.04
이벤트 중복 바인딩 방지  (0) 2016.06.14
html()의 사용과 innerHTML  (0) 2016.06.14
[API] toggleClass()  (1) 2015.07.28
<