Silverlight XAML Primer 14: Using Color Animations: Listing 2: Finding and playing storyboards based on user interaction with a Silverlight Canvas.
Color animations provide yet another tool that you can use to enhance a user interface and perform a variety of interesting effects.
function CreateSilverlight()
{
Silverlight.createObjectEx({
source:'XAML/ColorAnimations.xaml',
parentElement: document.getElementById('divSilverlight'),
id: 'slControl',
properties: {
width: '500',
height: '500',
background:'#ffffffff',
isWindowless: 'false',
version: '1.0'
},
events: {
onError: null,
onLoad: OnLoad
},
context: null
});
}
var slControl = null;
function OnLoad(control, context, rootElement)
{
slControl = control;
}
function OnMouseEnter(sender,args)
{
var animation = slControl.Content.FindName("OverAnimation");
animation.Begin();
}
function OnMouseLeave(sender,args)
{
var animation = slControl.Content.FindName("OutAnimation");
animation.Begin();
}