SilverlightShow: Smoke effect Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) Re: Smoke effect <p>You can increase the FPS and it should still look natural, but this will decrease the overall performance, because will have to redraw it more often. But still if it's not a problem for you, why not.</p> <p>Thanks for your comment.</p> http://www.silverlightshow.net/items/Smoke-effect.aspx#comment6611 miromiroslavov http://www.silverlightshow.net/items/Smoke-effect.aspx Wed, 05 Oct 2011 10:17:19 GMT Re: Smoke effect <p>Thanks for sharing this. The smoke effect is very good, and very similar to how smoke moves in real life. Is it possible to change the way the smoke moves by increasing the number of frames per second? Or would it end up looking unnatural?</p> <p> Gordon - <a href="http://www.e-cig-bargains.com/" target="_blank">Green Smoke Coupon </a></p> http://www.silverlightshow.net/items/Smoke-effect.aspx#comment6607 BlueBierd http://www.silverlightshow.net/items/Smoke-effect.aspx Wed, 05 Oct 2011 04:31:00 GMT Re: Smoke effect Very cool effect and it is great that you are willing to share it with the community like this. One questions I had was do you have any sample source code doing this in VB.NET? I'm a VB.NET user and I love to see tutorials in this language as opposed to C#. For example a tutorial like this one - that explains <a href="http://www.withvb.net/tutorials/simple-and-advanced-conditional-experssions">conditions in VB.NET</a> is very helpful. http://www.silverlightshow.net/items/Smoke-effect.aspx#comment6415 sammys111 http://www.silverlightshow.net/items/Smoke-effect.aspx Mon, 08 Aug 2011 00:48:53 GMT RE: Smoke effect <p>Really great instruction Miroslav!</p> <p>I'm waiting for more!</p> <p>Greetings</p> <p><a href="http://apps.wp-7.pl/">Windows Phone 7 </a></p> http://www.silverlightshow.net/items/Smoke-effect.aspx#comment6238 John http://www.silverlightshow.net/items/Smoke-effect.aspx Tue, 31 May 2011 14:02:50 GMT RE: Smoke effect <p>Ah ... sorry. What I forgot to mention is:</p> <p>The alternative approach provided works because the CompositionTarget.Rendering event <strong>is called by Silverlight 60 times each second</strong>.</p> <p>Best regards,</p> <p>Martin Krüger</p> http://www.silverlightshow.net/items/Smoke-effect.aspx#comment5366 LawBot http://www.silverlightshow.net/items/Smoke-effect.aspx Fri, 21 Jan 2011 18:35:37 GMT RE: Smoke effect <p>First: The idea is brilliant.</p> <p>Regarding your coding in the CompositionTarget_Rendering handler I would like to provide an alternative approach to implement a frame changing on "frame per second" basis:</p> <div class="reCodeBlock" style="overflow-y: auto;border: #7f9db9 1px solid;"> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">01.</code><span style="margin-left: 0px !important;"><code style="color: #069; font-weight: bold;">Private</code> <code style="color: #000;">cnt </code><code style="color: #069; font-weight: bold;">As</code> <code style="color: #069; font-weight: bold;">Double</code> <code style="color: #000;">= 0 </code></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">02.</code><span style="margin-left: 0px !important;"><code style="color: #069; font-weight: bold;">Private</code> <code style="color: #000;">ccnt </code><code style="color: #069; font-weight: bold;">As</code> <code style="color: #069; font-weight: bold;">Double</code> <code style="color: #000;">= 0 </code></span></div> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">03.</code><span style="margin-left: 0px !important;"><code style="color: #069; font-weight: bold;">Private</code> <code style="color: #000;">totalFrameCounter </code><code style="color: #069; font-weight: bold;">As</code> <code style="color: #069; font-weight: bold;">Integer</code> <code style="color: #000;">= 0 </code></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">04.</code><span style="margin-left: 0px !important;"><code style="color: #069; font-weight: bold;">Private</code> <code style="color: #000;">fps </code><code style="color: #069; font-weight: bold;">As</code> <code style="color: #069; font-weight: bold;">Double</code> <code style="color: #000;">= 24 </code></span></div> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">05.</code><span style="margin-left: 0px !important;"><code style="color: #069; font-weight: bold;">Private</code> <code style="color: #069; font-weight: bold;">Sub</code> <code style="color: #000;">MakeSprite(</code><code style="color: #069; font-weight: bold;">ByVal</code> <code style="color: #000;">sender </code><code style="color: #069; font-weight: bold;">As</code> <code style="color: #069; font-weight: bold;">Object</code><code style="color: #000;">, </code><code style="color: #069; font-weight: bold;">ByVal</code> <code style="color: #000;">e </code><code style="color: #069; font-weight: bold;">As</code> <code style="color: #000;">EventArgs) </code></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">06.</code><span><code>  </code><span style="margin-left: 6px !important;"><code style="color: #000;">ccnt += 1 / 60 </code></span></span></div> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">07.</code><span><code>  </code><span style="margin-left: 6px !important;"><code style="color: #069; font-weight: bold;">If</code> <code style="color: #000;">ccnt >= (1 / 60) * 60 / fps </code><code style="color: #069; font-weight: bold;">Then</code></span></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">08.</code><span><code>    </code><span style="margin-left: 12px !important;"><code style="color: #000;">cnt += 1 </code></span></span></div> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">09.</code><span><code>    </code><span style="margin-left: 12px !important;"><code style="color: #000;">imScene.Source = </code><code style="color: #069; font-weight: bold;">New</code> <code style="color: #000;">BitmapImage </code><code style="color: #069; font-weight: bold;">With</code> <code style="color: #000;">{.UriSource = </code><code style="color: #069; font-weight: bold;">New</code> <code style="color: #000;">Uri(GetImageName(cnt), UriKind.RelativeOrAbsolute)} </code></span></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">10.</code><span><code>    </code><span style="margin-left: 12px !important;"><code style="color: #069; font-weight: bold;">If</code> <code style="color: #000;">cnt = 118 </code><code style="color: #069; font-weight: bold;">Then</code></span></span></div> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">11.</code><span><code>      </code><span style="margin-left: 18px !important;"><code style="color: #069; font-weight: bold;">RemoveHandler</code> <code style="color: #000;">CompositionTarget.Rendering, </code><code style="color: #069; font-weight: bold;">AddressOf</code> <code style="color: #000;">MakeSprite </code></span></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">12.</code><span><code>      </code><span style="margin-left: 18px !important;"><code style="color: #000;">cnt = 0 </code></span></span></div> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">13.</code><span><code>    </code><span style="margin-left: 12px !important;"><code style="color: #069; font-weight: bold;">End</code> <code style="color: #069; font-weight: bold;">If</code></span></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">14.</code><span><code>    </code><span style="margin-left: 12px !important;"><code style="color: #000;">ccnt = 0 </code></span></span></div> <div style="background-color: #fff;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">15.</code><span><code>  </code><span style="margin-left: 6px !important;"><code style="color: #069; font-weight: bold;">End</code> <code style="color: #069; font-weight: bold;">If</code></span></span></div> <div style="background-color: #f8f8f8;"><code style="text-align: right; width: 3em; padding-right: 0.3em; display: block; float: left; color: #5c5c5c;">16.</code><span style="margin-left: 0px !important;"><code style="color: #069; font-weight: bold;">End</code> <code style="color: #069; font-weight: bold;">Sub</code></span></div> </div> <p>Best regards,</p> <p>Martin Krüger</p> http://www.silverlightshow.net/items/Smoke-effect.aspx#comment5365 LawBot http://www.silverlightshow.net/items/Smoke-effect.aspx Fri, 21 Jan 2011 18:33:15 GMT RE: Smoke effect smoking hot. http://www.silverlightshow.net/items/Smoke-effect.aspx#comment4327 me http://www.silverlightshow.net/items/Smoke-effect.aspx Wed, 25 Aug 2010 17:26:36 GMT RE: Smoke effect <p>Yep, seriously thinking of integrating this into my curent app.  </p> <p>I'll let you know how it goes.</p> http://www.silverlightshow.net/items/Smoke-effect.aspx#comment3668 Ian http://www.silverlightshow.net/items/Smoke-effect.aspx Wed, 26 May 2010 00:29:59 GMT RE: Smoke effect Brilliant!  You guys rock! http://www.silverlightshow.net/items/Smoke-effect.aspx#comment3636 Aaron http://www.silverlightshow.net/items/Smoke-effect.aspx Wed, 19 May 2010 16:26:44 GMT