]> source.dussan.org Git - gwtquery.git/commitdiff
color animation examples
authorJulien Dramaix <julien.dramaix@gmail.com>
Fri, 22 Apr 2011 09:09:14 +0000 (09:09 +0000)
committerJulien Dramaix <julien.dramaix@gmail.com>
Fri, 22 Apr 2011 09:09:14 +0000 (09:09 +0000)
samples/src/main/java/gwtquery/samples/ColorEffects.gwt.xml [new file with mode: 0644]
samples/src/main/java/gwtquery/samples/client/effects/ColorEffectsSample.java [new file with mode: 0644]
samples/src/main/java/gwtquery/samples/public/ColorEffectsSample.html [new file with mode: 0644]

diff --git a/samples/src/main/java/gwtquery/samples/ColorEffects.gwt.xml b/samples/src/main/java/gwtquery/samples/ColorEffects.gwt.xml
new file mode 100644 (file)
index 0000000..7690f01
--- /dev/null
@@ -0,0 +1,8 @@
+<module  rename-to='ColorEffectsSample'>
+       <inherits name='com.google.gwt.query.Query' />
+       <inherits name='com.google.gwt.user.theme.chrome.Chrome' />
+       <entry-point
+               class="gwtquery.samples.client.effects.ColorEffectsSample">
+       </entry-point>
+</module>
+
diff --git a/samples/src/main/java/gwtquery/samples/client/effects/ColorEffectsSample.java b/samples/src/main/java/gwtquery/samples/client/effects/ColorEffectsSample.java
new file mode 100644 (file)
index 0000000..ec9042f
--- /dev/null
@@ -0,0 +1,46 @@
+package gwtquery.samples.client.effects;
+
+import static com.google.gwt.query.client.GQuery.$;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.query.client.Function;
+import com.google.gwt.query.client.Properties;
+import com.google.gwt.query.client.css.CSS;
+import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing;
+
+public class ColorEffectsSample implements EntryPoint {
+
+  public void onModuleLoad() {
+
+    $("#shoot").click(new Function() {
+      
+      public void f() {
+        $("body").animate("backgroundColor: 'red'", 400)
+          .delay(1000)
+          .animate("backgroundColor: 'white'", 2000);
+      }
+      
+    });
+    
+    $("#startAnim2").click(new Function(){
+    
+      public void f() {
+        $(".bar").animate("backgroundColor: 'yellow'", 1000)
+          .delay(200)
+          .animate("borderColor: '#ff0000'",1000)
+          .delay(200)
+          .animate(Properties.create().$$("color","rgb(255, 255, 255)"), 1000, Easing.SWING);
+      }
+    
+    });
+    
+    $("#resetAnim2").click(new Function(){
+      
+      public void f() {
+        $(".bar").css(CSS.BACKGROUND_COLOR.with(null), CSS.BORDER_COLOR.with(null), CSS.COLOR.with(null));
+      }
+    
+    });
+  }
+
+}
diff --git a/samples/src/main/java/gwtquery/samples/public/ColorEffectsSample.html b/samples/src/main/java/gwtquery/samples/public/ColorEffectsSample.html
new file mode 100644 (file)
index 0000000..701a22c
--- /dev/null
@@ -0,0 +1,51 @@
+<!doctype html>\r
+<html>\r
+<head>\r
+<title>GQuery Effects Sample</title>\r
+<script language="javascript" src="ColorEffectsSample.nocache.js"></script>\r
+<style type="text/css">\r
+body {\r
+    font-family: Helvetica;\r
+}\r
+\r
+.reset {\r
+    float: left;\r
+}\r
+\r
+.foo {\r
+    margin-top: 100px;\r
+    margin-bottom: 100px; width : 100%;\r
+    color: white;\r
+    font-size: 60px;\r
+    text-align: center;\r
+    width: 100%;\r
+}\r
+\r
+.bar {\r
+    border: solid 10px black; \r
+    border-left-color: silver;\r
+    border-right-color: silver;\r
+    width : 200px;\r
+    height: 200px;\r
+    padding-top: 70px;\r
+    font-size: 30px;\r
+    text-align: center;\r
+    width: 200px;\r
+}\r
+</style>\r
+</head>\r
+<body>\r
+<h1>Animate css color properties</h1>\r
+<p>This example shows you how using gwtquery to perform animation on\r
+color css properties (backgroundColor, color, corderColor...)</p>\r
+<div>\r
+<button id="shoot">Shoot This page!</button>\r
+</div>\r
+<div class="foo">BANG !</div>\r
+<div>\r
+<button id="startAnim2">Start animation</button>\r
+<button id="resetAnim2">Reset animation</button>\r
+</div>\r
+<div class="bar">GwtQuery</div>\r
+</body>\r
+</html>\r