jQuery UI

Effects

Index

  1. Add Class
  2. Remove Class
  3. Color Animation
  4. Easing
  5. Effect
  6. Hide

Add Class

.addClass( className [, duration] [, easing] [, complete])

  • className : 클래스명
  • duration : 지속 시간 (default : 400)
  • easing : 변환 효과 (default : swing)
  • complete : animation이 끝나고 수행하는 function

Add Class

.addClass( className [, options])

  • className : 클래스명
  • options : 부가 옵션
    • duration : 지속 시간 (default : 400)
    • easing : 변환 효과 (default : swing)
    • complete : animation이 끝나고 수행하는 function
    • children : (default : false)
    • queue : 애니메이션 순차 적용 여부 (default : true)

 

Add Class

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Effects - addClass demo</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
    .toggler { width: 500px; height: 200px; position: relative; }
    #button { padding: .5em 1em; text-decoration: none; }
    #effect { width: 240px;  padding: 1em;  font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
    .newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
  </style>
  <script>
  $(function() {
    $( "#button" ).click(function() {
      $( "#effect" ).addClass( "newClass", 1000, callback );
    });
 
    function callback() {
      setTimeout(function() {
        $( "#effect" ).removeClass( "newClass" );
      }, 1500 );
    }
  });
  </script>
</head>
<body>
 
<div class="toggler">
  <div id="effect" class="ui-corner-all">
      Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede.
  </div>
</div>
 
<button id="button" class="ui-state-default ui-corner-all">Run Effect</button>
 
 
</body>
</html>

Remove Class

.removeClass( className [, duration] [, easing] [, complete])

  • className : 클래스명
  • duration : 지속 시간 (default : 400)
  • easing : 변환 효과 (default : swing)
  • complete : animation이 끝나고 수행하는 function

Remove Class

.removeClass( className [, options])

  • className : 클래스명
  • options : 부가 옵션
    • duration : 지속 시간 (default : 400)
    • easing : 변환 효과 (default : swing)
    • complete : animation이 끝나고 수행하는 function
    • children : (default : false)
    • queue : 애니메이션 순차 적용 여부 (default : true)

 

Remove Class

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Effects - removeClass Demo</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  .toggler { width: 500px; height: 200px; position: relative; }
  #button { padding: .5em 1em; text-decoration: none; }
  #effect { position: relative;  width: 240px;  padding: 1em;  letter-spacing: 0; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
  .newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
  </style>
  <script>
  $(function() {
    $( "#button" ).click(function() {
      $( "#effect" ).removeClass( "newClass", 1000, callback );
    });
 
    function callback() {
      setTimeout(function() {
        $( "#effect" ).addClass( "newClass" );
      }, 1500 );
    }
  });
  </script>
</head>
<body>
 
<div class="toggler">
  <div id="effect" class="newClass ui-corner-all">
    Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede.
  </div>
</div>
 
<button id="button" class="ui-state-default ui-corner-all">Run Effect</button>
 
 
</body>
</html>

Color Animation

Animate the properties of elements between colors.

Color Animation

  • jquery-color
    • jQuery plugin for color manipulation and animation support. 

Color Animation

  • Supported properties
    • backgroundColor
    • borderBottomColor
    • borderLeftColor
    • borderRightColor
    • borderTopColor
    • color
    • columnRuleColor
    • outlineColor
    • textDecorationColor
    • textEmphasisColor
  • Color Factory / Color Object
    • jQuery.Color( "#abcdef" );
    • jQuery.Color( "rgb(100,200,255)" );
    • jQuery.Color( "rgba(100,200,255,0.5)" );
    • jQuery.Color( "aqua" );
    • jQuery.Color( red, green, blue, alpha );
    • jQuery.Color([ red, green, blue, alpha ]);
    • jQuery.Color("Red");
    • jQuery.Color.names["red"] );
    • ...

Easing

  • Easing functions specify the rate of change of a parameter over time.
  • Using an HTML canvas element.
  • 애니메이션을 좀 더 효과적으로 사용하고자 할 때

Easing

Easing

Easing - example

Effect

.effect( effect [,options] [, duration] [, complete])

  • effect : 효과
  • options : Effect-specific properties and easing
  • duration : 지속 시간 (default : 400)
  • complete : animation이 끝나고 수행하는 function​

Effect

. effect(options)

  • options : 부가 옵션
    • effect : 효과
    • easing : 애니메이션 효과 (default : swing)
    • duration : 지속 시간 (default : 400)
    • complete : animation이 끝나고 수행하는 function
    • queue : 애니메이션 순차 적용 여부 (default : true)

Effect

  • Blind
    • hides or shows an element by wrapping the element in a container, and “pulling the blinds”
  • Bounce
    • bounces an element. When used with hide or show, the last or first bounce will also fade in/out.
  • Clip
    • hide or show an element by clipping the element vertically or horizontally.
  • Drop
    • hides or shows an element fading in/out and sliding in a direction.
  • Explode
    • hides or shows an element by splitting it into pieces.
  • Fade
    • hides or shows an element by fading it.
  • Fold
    • hides or shows an element by folding it.

Effect 종류

Effect

Effect 종류

  • Highlight
    • hides or shows an element by animating its background color first.
  • Puff
    • Creates a puff effect by scaling the element up and hiding it at the same time.
  • Pulsate
    • hides or shows an element by pulsing it in or out.
  • Scale
    • Shrink or grow an element by a percentage factor.
  • Shake
    • Shakes the element multiple times, vertically or horizontally.
  • Size
    • Resize an element to a specified width and height.
  • Slide
    • Slides the element out of the viewport.
  • Transfer
    • Transfers the outline of an element to another element.

Effect

Hide

.hide( effect [, options ] [, duration ] [, complete ] )

  • effect : 효과
  • options : Effect-specific properties and easing
  • duration : 지속 시간 (default : 400)
  • complete : animation이 끝나고 수행하는 function​

Hide

. hide(options)

  • options : 부가 옵션
    • effect : 효과
    • easing : 애니메이션 효과 (default : swing)
    • duration : 지속 시간 (default : 400)
    • complete : animation이 끝나고 수행하는 function
    • queue : 애니메이션 순차 적용 여부 (default : true)

Hide

Made with Slides.com