1stwebdesigner |
| Creating Stunning Visualizations with Impress.js Posted: 23 May 2012 06:00 AM PDT If this message appears to another site than 1stwebdesigner ,it has been stolen, please visit original source! Do you want to create beautiful slideshow presentations for the web using just HTML and CSS? That won’t be a problem with Impress.js, a powerful CSS3 transformation framework that lets you convert your HTML content into a slideshow with amazing effects. Impress.js is a jQuery plugin created on github by bartez which uses CSS3 functionality to create presentations. All the modern browsers will support the stunning visualizations created by Impress.js.
Downloading and Setup Impress.jsDownload Impress.js by visiting github. Click on the zip button as shown in the following screenshot and Impress.js library will be downloaded with the examples. Once the download is completed extract the zip folder and you will find sample files used for the Impress.js demo. Since our purpose is learning to use the Impress.js plugin, we should start coding from scratch. First create a basic html document as shown in the code below and include impress.js file. Basic HTML document with impress.js included <html lang="en"> <head> <title>Impress Demo</title> </head> <body> <script src="js/impress.js"></script> </body> </html> Initializing Impress.js In order to use Impress.js you need to use syntax defined by the library. The plugin searches for an element with the ID impress to create slides of your visualization. So we will create a div with the ID “impress”. Then you can initialize the library using the impress().init() function as shown in the code below. <html lang="en"> <head> <title>Impress Demo</title> </head> <body> <div id="impress"> </div> <script type="text/javascript">impress().init();</script> <script type="text/javascript" src="js/impress.js"></script> </body> </html> Now we are ready to explore the powerful features of Impress.js. Lets move onto creating slides. Lets Start Creating SlidesImpress.js powered slides can be anything and any size as long as it matches the criteria defined by the library. I have created 2 simple slides in the following code to get us started on our presentation. <html lang="en"> <head> <title>Impress Demo</title> </head> <body> <div id="impress"> <div id="start"> <p style='width:1000px;font-size:80px; text-align:center'>Creating Stunning Visualizations</p> <p>Impress.js </p> </div> <div id="slide2" data-x="-1200" data-y="0"> <p style='width:1000px;font-size:80px;'> First Slide Moves From Left To Right</p> <p>Impress.js </p> </div> </div> <script type="text/javascript">impress().init();</script> <script type="text/javascript" src="js/impress.js"></script> </body> </html> Explaining Slide Creation
Effects Supported In Impress.js LibraryCurrently there are several effects you can use in creating visualizations. If you are a CSS expert you will be able to find unlimited effects using these features supported by the library,
Now we have learned everything necessary to create a stunning visualization. Lets stop talking and make the visualization using combined impress.js features. Creating a Complete Visualization using Supported EffectsWe have already created two slides in our presentation. Lets make more slides with combining the effects of impress.js. I’ll show you the code for each slide and explain what it does exactly in the following section. Slide 3 <div id="slide3" data-x="2200" data-y="500"> <p>This Slide Moves From Right To Left and Bottom To Top</p> </div> Slide 4 <div id="slide4" data-x="2200" data-y="-500"> <p>This Slide Moves Top To Bottom</p> </div> Slide 5 <div id="slide5" data-x="3200" data-rotate="150"> <p>This Slide Rotates Clockwise Around z-axis</p> </div> Slide 6 <div id="slide6" data-x="6200" data-scale='3'> <p>This Slide Scales 3 Times</p> </div> Slide 7 <div id="slide7" data-x="4200" data-y='1500' data-z='1500'> <p>Away</p> </div> Slide 8 <div id="slide8" data-x="4900" data-y='1500' data-z='100'> <p>Towards</p> </div> Slide 9 <div id="slide9" data-x="5600" data-y='1500' data-z='-1500'> <p>Futher Towards</p> </div> Slide 10 <div id="slide10" data-x="6600" data-y='3000' data-scale='10'> <p>Visualization Slide Positions</p> </div> Now we are done with our presentation and full source code is given in the following section. I have used slide specific CSS styles in this example. Feel free to add your own styles and change the look and feel of your Impress.js visualization. <html lang="en"> <head> <style> body{ width:1024px; font-size:20px; background: rgb(215, 215, 215); background: -webkit-radial-gradient(#FFFFFF, #68BEFB); background: -moz-radial-gradient(#FFFFFF, #68BEFB) repeat scroll 0 0 transparent; background: -ms-radial-gradient(#FFFFFF, #68BEFB); background: -o-radial-gradient(#FFFFFF, #68BEFB); background: radial-gradient(#FFFFFF, #68BEFB); } #start{ text-align:center; width:1024px; font-size:80px; } #slide1{ text-align:center; width:1024px; font-size:80px; } #slide2{ text-align:center; width:1024px; font-size:80px; } .step{ text-align:center; width:1024px; font-size:80px; } #slide7{ width:400px; } #slide8{ width:400px; } #slide9{ width:400px; } .hint_text{ font-size:30px; background-color:#EEE; padding:15px; } .fallback-message { font-family: sans-serif; line-height: 1.3; width: 780px; padding: 10px 10px 0; margin: 20px auto; border: 1px solid #E4C652; border-radius: 10px; background: #EEDC94; } .fallback-message p { margin-bottom: 10px; } .impress-supported .fallback-message { display: none; } </style> </head> <body> <div id="impress"> <div id="start" > <p>Creating Stunning Visualizations</p> <p>Impress.js </p> <p class='hint_text'>Press Spacebar or Tab To Get Started</p> </div> <div id="slide1" data-x="-1200"> <p>This Slide Moves From Left To Right</p> </div> <div id="slide2" data-x="1200"> <p>This Slide Moves From Right To Left</p> </div> <div id="slide3" data-x="2200" data-y="500"> <p>This Slide Moves From Right To Left and Bottom To Top</p> </div> <div id="slide4" data-x="2200" data-y="-500"> <p>This Slide Moves Top To Bottom</p> </div> <div id="slide5" data-x="3200" data-rotate="150"> <p>This Slide Rotates Clockwise Around z-axis</p> </div> <div id="slide6" data-x="6200" data-scale='3'> <p>This Slide Scales 3 Times</p> </div> <div id="slide7" data-x="4200" data-y='1500' data-z='1500'> <p>Away</p> </div> <div id="slide8" data-x="4900" data-y='1500' data-z='100'> <p>Towards</p> </div> <div id="slide9" data-x="5600" data-y='1500' data-z='-1500'> <p>Futher Towards</p> </div> <div id="slide10" data-x="6600" data-y='3000' data-scale='10'> <p>Visualization Slide Positions</p> </div> </div> <div> <p>Your browser <b>doesn't support the features required</b> by impress.js, so you are presented with a simplified version of this presentation.</p> <p>For the best experience please use the latest <b>Chrome</b>, <b>Safari</b> or <b>Firefox</b> browser.</p> </div> <script type="text/javascript" src="js/impress.js"></script> <script type="text/javascript">impress().init();</script> </body> </html></pre> <div></div> <pre> Checking Browser CompatibilityApart from Opera, Impress.js visualizations are supported in all new versions of major browsers like Firefox, Chrome, Safari and Internet Explorer 10. If the browser is not supported, we can use the fallback message defined by the library. I have included it in the full source code above. Additional styles have to be defined in order to show it properly. All the code required for a browser fallback message is given below: <style> .fallback-message { font-family: sans-serif; line-height: 1.3; width: 780px; padding: 10px 10px 0; margin: 20px auto; border: 1px solid #E4C652; border-radius: 10px; background: #EEDC94; } .fallback-message p { margin-bottom: 10px; } .impress-supported .fallback-message { display: none; } </style> <div> <p>Your browser <b>doesn't support the features required</b> by impress.js, so you are presented with a simplified version of this presentation.</p> <p>For the best experience please use the latest <b>Chrome</b>, <b>Safari</b> or <b>Firefox</b> browser.</p> </div> Whats Next ?This tutorial provides a basic visualization which is used to explain the Impress.js effects. You can use CSS3 features like transition, shadows and gradients in the content of slides to create much more creative visualizations. Also make sure to change and use suitable x and y values for your slides to avoid overlapping of content. Check out some Impress.js powered visualizations given below.
|
| You are subscribed to email updates from 1stwebdesigner To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
| Google Inc., 20 West Kinzie, Chicago IL USA 60610 | |
Niciun comentariu:
Trimiteți un comentariu