<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>{Dev Tricks} &#187; Blend</title>
	<atom:link href="http://dev-tricks.net/category/code/silverlight/blend-silverlight-code/feed" rel="self" type="application/rss+xml" />
	<link>http://dev-tricks.net</link>
	<description>Blogging developper tips and tricks</description>
	<lastBuildDate>Thu, 17 May 2012 13:09:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Silverlight Tutorial &#8211; Flashlight Tutorial</title>
		<link>http://dev-tricks.net/silverlight-flashlight-tutorial</link>
		<comments>http://dev-tricks.net/silverlight-flashlight-tutorial#comments</comments>
		<pubDate>Mon, 19 Jan 2009 20:48:13 +0000</pubDate>
		<dc:creator>Antoine Angot</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[blend]]></category>

		<guid isPermaLink="false">http://dev-tricks.net/?p=80</guid>
		<description><![CDATA[How to make a flashlight effect with silverlight ? &#160; &#160; &#160; &#160; What you need : &#160; be familiar with Blend be familiar with Visual Studio half an hour &#160; &#160; &#160; Introduction &#160; Many years ago, a friend &#8230; <a href="http://dev-tricks.net/silverlight-flashlight-tutorial">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>How to make a flashlight effect with silverlight ?<br />
&nbsp;<br />
&nbsp;<br />
<iframe frameborder="no" height="300" width="400" src="http://code.dev-tricks.net/flashlight/Default.html"></iframe><br />
&nbsp;<br />
&nbsp;<br />
<span id="more-80"></span></p>
<ul>
<strong>What you need :</strong><br />
&nbsp;</p>
<li> be familiar with Blend</li>
<li> be familiar with Visual Studio</li>
<li> half an hour</li>
</ul>
<ul>
&nbsp;<br />
&nbsp;<br />
&nbsp;</p>
<h3>Introduction</h3>
<p>&nbsp;<br />
Many years ago, a friend taught me <strong>how to make a flash light effect with flash</strong>.<br />
You probably saw it in many <a href="http://code.dev-tricks.net/flashlight/swf.swf">tutorials</a>.<br />
&nbsp;<br />
&nbsp;<br />
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="250"><param name="movie" value="http://code.dev-tricks.net/flashlight/swf.swf"><param name="quality" value="high"><embed src="http://www.newtutorials.com/flashlight/flashlight-6.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="400" height="250"></embed></object><br />
&nbsp;<br />
Today, we will try to do better with silverlight :)</p>
<p>&nbsp;<br />
&nbsp;<br />
&nbsp;</p>
<h3>The Blend Part</h3>
<p>&nbsp;</p>
<ol>
<h4>Create a new project</h4>
</ol>
<p>&nbsp;<br />
<img src="http://dev-tricks.net/wp-content/uploads/2009/01/1-300x181.jpg" alt="I’m doing it with Blend, but you can use Visual Studio if you want. " title="Create a silverlight project" width="400" class="size-medium wp-image-132" /></p>
<ol>
<em>I&#8217;m doing it with Blend, but you can use Visual Studio if you want. </em></ol>
<p>&nbsp;<br />
&nbsp;</p>
<ol>
<h4>Add an image</h4>
</ol>
<p>&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/a.JPG" width="200"></p>
<ol>
<em>Add it to the project.</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/2.JPG"></p>
<ol>
<em>Resize the image to give it the same size that the LayoutRoot</em></ol>
<p>&nbsp;<br />
&nbsp;</p>
<ol>
<h4>Draw a rectangle</h4>
</ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/b.JPG" width="200"></p>
<ol>
<em>select the tool</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/3.JPG" width="400"></p>
<ol>
<em>You should get this.</em></ol>
<p>&nbsp;<br />
&nbsp;</p>
<ol>
<h4>Gradient Brush and Radial Gradient</h4>
</ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/c.JPG"></p>
<ol>
<em>Set up the rectangle background as a gradientbrush</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/d.JPG"></p>
<ol>
<em>And click on the radial gradient option</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/4.JPG"></p>
<ol>
<em>You rectangle should look like this.</em></ol>
<p>&nbsp;<br />
&nbsp;</p>
<ol>
<h4>Transparency</h4>
</ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/e.JPG"></p>
<ol>
<em>Set the first gradiant to black</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/f.JPG"></p>
<ol>
<em>For the other one, same color but set transparenrcy to half</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/5.JPG"></p>
<ol>
<em>We begin to see the final result</em></ol>
<ol>
&nbsp;<br />
&nbsp;</p>
<h4>Draw your Flashlight</h4>
</ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/g.JPG"></p>
<ol>
<em>Play with gradiant and try to make something which looks like a light.</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/6.JPG"></p>
<ol>
<em>Here is the artistical part :)</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/h.JPG"></p>
<ol>
<em>Well, i think i&#8217;m fine.</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/7.JPG"></p>
<ol>
<em>For me, it looks like this.</em></ol>
<p>&nbsp;<br />
&nbsp;</p>
<ol>
<h4>Transform the Brush</h4>
</ol>
<p>&nbsp;<br />
&nbsp;<br />
if you want to be able to move, you have to enlarge the brush.<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/i.JPG"></p>
<ol>
<em>Select the &#8220;Brush Transform&#8221; tool.</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
<img src="http://code.dev-tricks.net/flashlight/8.JPG"></p>
<ol>
<em>Resize the brush to about one and half.</em></ol>
<p>&nbsp;<br />
&nbsp;<br />
&nbsp;<br />
&nbsp;</p>
<h3>The Visual Studio part</h3>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Ok this part is ridiculous you have to add a method in FlashLight.xaml.cs to register mouse move.<br />
&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> FlashLight
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">partial</span> <span style="color: #6666cc; font-weight: bold;">class</span> Page <span style="color: #008000;">:</span> UserControl
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> Page<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Required to initialize variables</span>
            InitializeComponent<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            LayoutRoot<span style="color: #008000;">.</span><span style="color: #0000FF;">MouseMove</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> MouseEventHandler<span style="color: #008000;">&#40;</span>LayoutRoot_MouseMove<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">void</span> LayoutRoot_MouseMove<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, MouseEventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            Point newPosition <span style="color: #008000;">=</span> e<span style="color: #008000;">.</span><span style="color: #0000FF;">GetPosition</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            RadialGradientBrush radialGradient <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>RadialGradientBrush<span style="color: #008000;">&#41;</span>Light<span style="color: #008000;">.</span><span style="color: #0000FF;">Fill</span><span style="color: #008000;">;</span>
            radialGradient<span style="color: #008000;">.</span><span style="color: #0000FF;">GradientOrigin</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>newPosition<span style="color: #008000;">.</span><span style="color: #0000FF;">X</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">640</span>, newPosition<span style="color: #008000;">.</span><span style="color: #0000FF;">Y</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">400</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Light<span style="color: #008000;">.</span><span style="color: #0000FF;">Fill</span> <span style="color: #008000;">=</span> radialGradient<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>&nbsp;<br />
&nbsp;<br />
&nbsp;</p>
<h3>Conclusion</h3>
<p>&nbsp;<br />
&nbsp;<br />
Actually, i&#8217;m pretty sure that you can do the same with the last version of Flash but this tutorial is a good exercise to practice with Blend.<br />
Thanks for reading. You can download the <strong> source code </strong> <a href="http://code.dev-tricks.net/flashlight/FlashLight.zip">here</a>.<br />
&nbsp;<br />
&nbsp;
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dev-tricks.net/silverlight-flashlight-tutorial/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to make a fake 3D Storyboard with Expression Blend</title>
		<link>http://dev-tricks.net/fake-3d-with-blend</link>
		<comments>http://dev-tricks.net/fake-3d-with-blend#comments</comments>
		<pubDate>Sun, 24 Aug 2008 23:41:34 +0000</pubDate>
		<dc:creator>Antoine Angot</dc:creator>
				<category><![CDATA[Blend]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[blend]]></category>
		<category><![CDATA[how to]]></category>

		<guid isPermaLink="false">http://dev-tricks.net/?p=29</guid>
		<description><![CDATA[In this &#8220;how to&#8221; i will show you how to make a StoryBoard like this: This is not hard but you have to be famialiar with Blend. download this video]]></description>
			<content:encoded><![CDATA[<p>In this &#8220;how to&#8221; i will show you how to make a StoryBoard like this:</p>
<p><iframe frameborder="no" height="250" src="http://code.dev-tricks.net/TutoBlend1.html"></iframe></p>
<p>This is not hard but you have to be famialiar with Blend.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/y0xd_R141ys&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/y0xd_R141ys&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><a href="http://media.dev-tricks.net/TutoBlend1.zip">download this video</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dev-tricks.net/fake-3d-with-blend/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

