You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/04/21 03:17:27 UTC

[3/4] wp7 commit: fancy animation on load, ala metro style

fancy animation on load, ala metro style


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/cea4bc55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/cea4bc55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/cea4bc55

Branch: refs/heads/master
Commit: cea4bc550a5628984c213c63ac0e62af7c5dbd8d
Parents: 9bbb508
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Apr 20 17:55:38 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Apr 20 17:55:38 2012 -0700

----------------------------------------------------------------------
 framework/CordovaView.xaml    |   17 ++++++++++++++++-
 framework/CordovaView.xaml.cs |   10 +++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/cea4bc55/framework/CordovaView.xaml
----------------------------------------------------------------------
diff --git a/framework/CordovaView.xaml b/framework/CordovaView.xaml
index d24e68b..cab5b40 100644
--- a/framework/CordovaView.xaml
+++ b/framework/CordovaView.xaml
@@ -13,10 +13,12 @@
     <Grid x:Name="LayoutRoot" Background="Transparent">
         
         <phone:WebBrowser x:Name="CordovaBrowser" 
+                          Opacity="0"
                           HorizontalAlignment="Stretch"  
                           VerticalAlignment="Stretch" 
                           IsScriptEnabled="True" 
                           Foreground="White"
+                          Background="Black"
                           Navigated="GapBrowser_Navigated" 
                           Loaded="GapBrowser_Loaded" 
                           Unloaded="GapBrowser_Unloaded" 
@@ -24,7 +26,20 @@
                           LoadCompleted="GapBrowser_LoadCompleted" 
                           Navigating="GapBrowser_Navigating" 
                           NavigationFailed="GapBrowser_NavigationFailed" 
-                          IsGeolocationEnabled="True" />
+                          IsGeolocationEnabled="True">
+            <phone:WebBrowser.Projection>
+                <PlaneProjection x:Name="BrowserProjector" CenterOfRotationX="0" RotationY="-180"/>
+            </phone:WebBrowser.Projection>
+            <phone:WebBrowser.Resources>
+                <Storyboard x:Name="RotateIn" BeginTime="0:0:0.5">
+                    <DoubleAnimation
+                        Storyboard.TargetName="BrowserProjector"
+                        Storyboard.TargetProperty="RotationY"
+                        To="0" Duration="0:0:0.6"/>
+                </Storyboard>
+            </phone:WebBrowser.Resources>
+
+        </phone:WebBrowser>
         
     </Grid>
 </UserControl>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/cea4bc55/framework/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/framework/CordovaView.xaml.cs b/framework/CordovaView.xaml.cs
index d399a16..776bf23 100644
--- a/framework/CordovaView.xaml.cs
+++ b/framework/CordovaView.xaml.cs
@@ -347,18 +347,22 @@ namespace WP7CordovaClassLib
 
         void GapBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
         {
-            this.CordovaBrowser.Opacity = 1;
-
             string nativeReady = "(function(){ cordova.require('cordova/channel').onNativeReady.fire()})();";
 
             try
             {
                 CordovaBrowser.InvokeScript("execScript", new string[] { nativeReady });
             }
-            catch (Exception ex)
+            catch (Exception /*ex*/)
             {
                 Debug.WriteLine("Error calling js to fire nativeReady event. Did you include cordova-x.x.x.js in your html script tag?");
             }
+
+            if (this.CordovaBrowser.Opacity < 1)
+            {
+                this.CordovaBrowser.Opacity = 1;
+                RotateIn.Begin();
+            }
         }