JavaScript DHTML/Ext JS/Animation

Материал из Web эксперт
Версия от 07:21, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Animated window display

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">

Ext.onReady(function(){
  
    var w = new Ext.Window({
      height: 500,
      width: 500
    });
    w.show("animTarget", function() { alert("alert"); }, this);
});
</script>
<body>
    <div id="animTarget">
    </div>
</body>
</html>



Animation: Move Div tag to a new position

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
<style type="text/css">
div {
  border  : 1px solid #AAAAAA; 
  width   : 200; 
  cursor  : pointer;
  padding : 2px 2px 2px 2px;
  margin  : 2px 2px 2px 2px;  
}  
</style>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function() {
  var myDiv1 = Ext.get("div1");
  var newX = 50;
  var newY = 10;
  
  myDiv1.moveTo(newX, newY, {
    callback : function() {
      var msgX = Math.ceil(this.getX());
      var msgY= Math.ceil(this.getY());        
      var msg = "X = " + msgX + " Y = " + msgY;
      this.update(msg);
    }
  });

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



Block and inline frame animation

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").frame("ff0000", 3);
    Ext.get("inline").frame("ff0000", 3);
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Fadein block and inline tags

  

<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").fadeOut();
    Ext.get("inline").fadeOut();
    
    Ext.get("block").fadeIn();
    Ext.get("inline").fadeIn();
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Fade out block and inline tags

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").fadeOut();
    Ext.get("inline").fadeOut();
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Fly away ghost

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").ghost();
    Ext.get("inline").ghost("tr");
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Hide panel with slidein

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function() {
var myButton = new Ext.Button({
  text    : "hide me",
  handler : function() {
    myPanel.el.switchOff({
      callback : function() {
        myPanel.el.slideIn.defer(500, myPanel.el, []);
      }
    });
  } 
});
myPanel = new Ext.Panel({
  width    : 200,
  height   : 100,
  title    : "Title me",
  frame    : true,
  renderTo : Ext.getBody(), 
  items    :  myButton 
});
});
</script> 
<div id="div1">asdf</div>
</body>
</html>



Highlight block and inline tags

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").highlight();
    Ext.get("inline").highlight();
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Puff inline and block tags

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").puff();
    Ext.get("inline").puff();
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Scale animation

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").scale(50, 50);
    Ext.get("inline").scale(300, 20);
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Shift a tag

   
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").shift({x: 5, y: 300, width: 300, height: 200});
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Slide in animation

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").slideIn();
    Ext.get("inline").slideIn("tl");
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Slide out animation

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").slideOut();
    Ext.get("inline").slideOut("tl");
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>



Switchoff Animation

  
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
  
    Ext.get("block").switchOff();
    Ext.get("inline").switchOff();
});
</script>
<body>
  <div id="container">  
    <div id="block">
      <p>I Am A Block Element</p>
    </div>
    <span id="inline">I Am An Inline Element</span>
  </div>
</body>
</html>