{"id":3311,"date":"2011-08-11T07:36:00","date_gmt":"2011-08-11T15:36:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=3311"},"modified":"2011-08-11T07:36:21","modified_gmt":"2011-08-11T15:36:21","slug":"primalforms-2011-create-an-awesome-fade-in-form","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2011\/08\/11\/primalforms-2011-create-an-awesome-fade-in-form\/","title":{"rendered":"PrimalForms 2011: Create an Awesome Fade In Form"},"content":{"rendered":"<p>Did you ever want to make your forms a little more flashy? How about creating an Awesome Fade In Form? Yeah that\u2019s right I said Awesome!<\/p>\n<p><font color=\"#800000\">[Start Deep Voice]<\/font><\/p>\n<p>Everybody loves it when their forms make a smooth entrance. Ohhh Yeahhh\u2026<\/p>\n<p>As opposed to the typical abrupt \u201chere I am\u201d way. But then again, whatever floats your boat baby.<\/p>\n<p><font color=\"#800000\">[End Deep voice]<\/font> <\/p>\n<p>With few simple steps your form will be styling into existence.<\/p>\n<p><strong><font size=\"3\">Steps to make your Awesome Fade in Form:<\/font><\/strong><\/p>\n<p><strong>Step 1: Use the Alpha Luke!<\/strong> <\/p>\n<blockquote>\n<p>Well it\u2019s actually called Opacity, but essentially the same as alpha or transparency. You can either set the Form\u2019s Opacity to 0% (Invisible) in the Designer or dynamically set it on the Form\u2019s Load event. In this sample I will set in the Form\u2019s Load event:<\/p>\n<p><span style=\"color: #8b0000\">$form1<\/span><span style=\"color: #000000\">.Opacity <\/span><span style=\"color: #0000ff\">= <\/span><span style=\"color: #000000\">0<\/span><span style=\"color: #000000\"> <\/span><\/p>\n<\/blockquote>\n<p><strong>Step 2: Add the Timer<\/strong><\/p>\n<blockquote><\/blockquote>\n<blockquote>\n<p>Next, add a Timer Control to handle the fade in effect. Change the Timer\u2019s Interval property in order to speed up or slow down the fade in effect.<\/p>\n<p>&nbsp;<img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Timer Properties\" border=\"0\" alt=\"Timer Properties\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2011\/08\/Timer-Properties.png\" width=\"220\" height=\"202\"><\/p>\n<\/blockquote>\n<p><strong>Step 3: Add a Tick Event (Did you hear that? It\u2019s time to be Awesome!)<\/strong><\/p>\n<blockquote>\n<p>Now add the Timer\u2019s Tick event and increments the Form\u2019s Opacity until it\u2019s at its full glory:<\/p>\n<\/blockquote>\n<pre><span style=\"color: #8b0000\">$timerFadeIn_Tick<\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\">{\n    <\/span><span style=\"color: #008000\">#Can you see me now?<\/span><span style=\"color: #000000\">\n    <\/span><span style=\"color: #0000ff\">if<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #8b0000\">$form1<\/span><span style=\"color: #000000\">.Opacity <\/span><span style=\"color: #0000ff\">-lt<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">1<\/span><span style=\"color: #000000\">)\n    {\n        <\/span><span style=\"color: #8b0000\">$form1<\/span><span style=\"color: #000000\">.Opacity <\/span><span style=\"color: #0000ff\">+=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">0<\/span><span style=\"color: #000000\">.<\/span><span style=\"color: #000000\">1<\/span><span style=\"color: #000000\">\n        \n        <\/span><span style=\"color: #0000ff\">if<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #8b0000\">$form1<\/span><span style=\"color: #000000\">.Opacity <\/span><span style=\"color: #0000ff\">-ge<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #000000\">1<\/span><span style=\"color: #000000\">)\n        {\n            <\/span><span style=\"color: #008000\">#Stop the timer once we are 100% visible<\/span><span style=\"color: #000000\">\n            <\/span><span style=\"color: #8b0000\">$timerFadeIn<\/span><span style=\"color: #000000\">.Stop()\n        }\n    }\n}<\/span><\/pre>\n<p><strong>Step 4: Let\u2019s get it on!<\/strong><\/p>\n<blockquote>\n<p>Let\u2019s get it on (or should I say turn it on?) by starting the Timer on the Forms Load event:<\/p>\n<\/blockquote>\n<pre><span style=\"color: #8b0000\">$FormEvent_Load<\/span><span style=\"color: #0000ff\">=<\/span><span style=\"color: #000000\">{\n    <\/span><span style=\"color: #008000\">#Start the Timer to Fade In<\/span><span style=\"color: #000000\">\n    <\/span><span style=\"color: #8b0000\">$timerFadeIn<\/span><span style=\"color: #000000\">.Start()\n    <\/span><span style=\"color: #8b0000\">$form1<\/span><span style=\"color: #000000\">.Opacity <\/span><span style=\"color: #0000ff\">= <\/span><span style=\"color: #000000\">0<\/span><span style=\"color: #000000\">\n}<\/span><\/pre>\n<p>And now we have the Awesome Fade In Form in action:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Start Fade In\" border=\"0\" alt=\"Start Fade In\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2011\/08\/Start-Fade-In1.png\" width=\"286\" height=\"157\"><\/p>\n<p>Whaaa?! <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Fade In Middle\" border=\"0\" alt=\"Fade In Middle\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2011\/08\/Fade-In-Middle1.png\" width=\"286\" height=\"157\"><\/p>\n<p>What\u2019s that? It can\u2019t be!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"End Fade In\" border=\"0\" alt=\"End Fade In\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2011\/08\/End-Fade-In1.png\" width=\"286\" height=\"157\"><\/p>\n<p>Yeah, that\u2019s right! Its my Awesome Fade In Form!<\/p>\n<p>&nbsp;<\/p>\n<p><font color=\"#800000\">[Start Deep Voice]<\/font> <\/p>\n<p>Damn\u2026 You\u2019re one sexy form!<\/p>\n<p><font color=\"#800000\">[End Deep Voice]<\/font><\/p>\n<p>Download the <a href=\"http:\/\/www.sapien.com\/downloads#Sample Scripts\/PrimalForms 2011\/FadeInForm.zip\">Fade In Form Sample<\/a> from the <a href=\"http:\/\/sapien.com\/downloads\">Download<\/a> section. That\u2019s right! You can\u2019t keep your hands off it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Did you ever want to make your forms a little more flashy? How about creating an Awesome Fade In Form? Yeah that\u2019s right I said Awesome! [Start Deep Voice] Everybody loves it when their forms make a smooth entrance. Ohhh Yeahhh\u2026 As opposed to the typical abrupt \u201chere I am\u201d way. But then again, whatever [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[283,509,575,25],"tags":[678,314,427,312],"class_list":["post-3311","post","type-post","status-publish","format-standard","hentry","category-howto","category-primalforms-software-news","category-primalforms-2011-software-news","category-windows-powershell","tag-fade-in-form","tag-primalforms","tag-timer","tag-winforms"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/3311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=3311"}],"version-history":[{"count":11,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/3311\/revisions"}],"predecessor-version":[{"id":3336,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/3311\/revisions\/3336"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=3311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=3311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=3311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}