`

超强的制作PPT的impress.js

阅读更多

在查看网页时,忽然发现了Impress.js 很强大,很简单的制作PPT的js.

附件是demo

以下是 对官方文档的关键点的中英文翻译

<!--[if gte mso 9]><xml><w:WordDocument><w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel><w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery><w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery><w:DocumentKind>DocumentNotSpecified</w:DocumentKind><w:DrawingGridVerticalSpacing>7.8</w:DrawingGridVerticalSpacing><w:View>Normal</w:View><w:Compatibility></w:Compatibility><w:Zoom>0</w:Zoom></w:WordDocument></xml><![endif]-->

How To Use Impress.Js

如何使用Impress.js

Posted on January 4, 2012

发表于20120104

Yesterday, I wrote about Impress.js, an awesome JavaScript library for creating online presentations. Since posting online, I’ve had several people ask how exactly to use it, as there’s no set documentation on the actual project page.  This guide will help you get started and allow you to create a simple slideshow, but after completing it please bear in mind that there’s so much more that can be done with it.  The only limit is your creativity!

昨天,我写了一个相当棒用于在线演示的javascript类库--Impress.js。因为在实际的项目页面也没有一套文档,我发帖以 来,有很多人问到底怎么使用。这个指南将帮助你开始创建一个简单的幻灯片。完成之后,请您也记住:它还可以做很多。唯一限制你的是你的创造力。

This tutorial is available for you to view and download on GitHub

Requirements(要求)

To see this tutorial in action, please use Google Chrome or Safari (or Firefox 10 or IE10).  Impress.js is not currently compatible with earlier versions of Firefox or Internet Explorer.

要看到这个文章的效果,请使用Google ChromeSafari(Firefox10 IE10)Impress.jsfirefoxie的早起版本将不能完全显示的.
--因为用到了HTML5+CSS3

 

Setup安装

The first thing you want to do is create a new webpage.  Mine’s index.html and within it setup the basic head and body elements.

你要做的第一件事就是建一个网页。以下是我的页面index.html基本的headbody元素。

<!doctype html>

<html>

    <head>

        <title>Impress Tutorial</title>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    </head>

    <body>

    </body>

</html>

Add the impress.js file before the end of the body element.  This imports the Impress library into your project

body元素结束前增加impress.js文件来将Impress类库导入到你的项目中

<script type="text/javascript" src="impress.js"></script>

Next we’ll create a wrapper which will contain the slideshow.  This is simply a <div> element with an id of ‘impress’

接下来,我们将创建一个包装器来包含幻灯片。这是一个简单的id=impressdiv元素

<div id="impress"></div>

Creating Slides创建幻灯片

Now you’ll see how easy it is to create a new slide in the presentation.  Each slide is a <div> element (within the wrapper) with a class name of ‘step’

现在,你将发现在演示文稿中创建一个幻灯片是多么容易。每个幻灯片都是一个带有step类名的div元素

<div class="step">

    My first slide

</div>

Whilst that creates a simple slide, things are a lot more fun you start adding data properties to your slides.  Data attributes signify properties of your slide for when it’s NOT the active slide.  The following data properties are available to you:
虽然那创建了一个简单的幻灯片,但在你的幻灯片中增加数据属性也是非常有趣的。Data属性标注了当幻灯片不是活动幻灯片是的信息。以下数据为:

· data-x = the x co-ordinate of the slide 幻灯片的x坐标

· data-y = the y co-ordinate of the slide 幻灯片的y坐标

· data-z = the z co-ordinate of the slide (how far/close it appears to the user)幻灯片的z坐标

· data-scale = scales your slide by a factor of this value.  A data-scale of 5 would be 5 times the original size of your slide 缩放幻灯片的因素

· data-rotate = rotates your slide by the specified number of degrees 通过指定的度数旋转你的幻灯片

· data-rotate-x = For 3D slides.  This is the number of degrees it should be rotated about the x-axis.  (Tilt forward/lean back)

· data-rotate-y = For 3D slides. This is the number of degrees it should be rotated about the y-axis (swing in from the left/right)

· data-rotate-z = For 3D slides. This is the number of degrees it should be rotated about the z-axis

 

Data Attributes In Action

The following slide configuration will guide you through each of the data attributes in action.

Let’s start with an initial slide.  This slide has it’s x and y data attributes set to 0, so will appear in the center of the page.

<div class="step" data-x="0" data-y="0">

    This is my first slide

</div>

The second slide will have an x position of 500, but the y position of 0.  This means that it’s going to have to come in 500 pixels across the x-axis (slide left) when it becomes active.

<div class="step" data-x="500" data-y="0">

    This is slide 2

</div>

Easy huh?  The next slide will start with the same x-position as slide 2, but a y position of –400.  This will slide in from the top 400 pixels.

<div class="step" data-x="500" data-y="-400">

    This is slide 3

</div>

Slide 4 uses the scale value to show how a slide can appear to zoom in/out.  It has a scale value of 0.5, meaning that it’s half the size it should be.  When it becomes active the presentation will adjust the scale of ALL the slides by the factor required to make the scale of the active website 1.  What this means in this example is that for this slide to display normally (scale value 1) it will need to be scaled up by a factor of 2 (0.5*2 = 1).  All the other slides will also be scaled up by a factor of two, and become twice the size.

<div class="step" data-x="500" data-y="-800" data-scale="0.5">

    This is slide 4

</div>

The rotate attributes allows you to rotate a slide into view.  Slide 5 is set to rotate by 90 degrees.

<div class="step" data-x="0" data-y="-800" data-rotate="90">

    This is slide 5 and it rotates in.

</div>

Finally, for a 3D transition, you can specify rotate attributes for each dimensional axis (x,y,z).

The x axis is the horizontal axis.  This means that you can make things tilt forwards (positive value) or backwards (negative value).
The y axis is the vertical axis so you can have things swing in from the left (negative value) or right (positive value).
The z axis is the depth axis (the one coming out at you) so rotating things on this would be rotating things up (negative value) and down (positive value).

Combinations

Now that you know all about the data attributes, which is really all you need to animate your slideshow, you can use your imagination to combine these in weird and wonderful ways to create your own style of slideshow.

<div class="step" data-x="-2600" data-y="-800" data-rotate-x="30" data-rotate-y="-60" data-rotate-z="90" data-scale="4">

    This is slide 7 and it has a 3D transition AND a scale.

</div>

Unsupported Browsers

Impress automatically detects whether or not a browser supports it or not, and if it doesn’t then automatically adds a class name called ‘impress-not-supported’ to the wrapper ‘<div>’.  Using some CSS we can show a message to people on browsers which aren’t supported by Impress.

At the start of your <div id=”impress”> add the following:

<div class="no-support-message">

    Your browser doesn't support impress.js.  Try Chrome or Safari.

</div>

Then, create a stylesheet or add this to your existing stylesheet:

.no-support-message { display:none; }

.impress-not-supported .no-support-message { display:block; }

This hides the message by default, but then displays it to browser if the impress-not-supported class is present.

Have fun!

This tutorial covers the fundamentals of using Impress.js to create your very own online presentation.  The entire example is available on Github for you to download and play with.

- See more at: http://www.cubewebsites.com/blog/guides/how-to-use-impress-js/#sthash.eYP2BTAi.dpuf

 

分享到:
评论

相关推荐

    [Impress.js] 构建特炫效果应用 (Impress.js 实现) (英文版)

    [Packt Publishing] 构建特炫效果应用 (Impress.js 实现) (英文版) [Packt Publishing] Building Impressive Presentations with Impress.js (E-Book) ☆ 出版信息:☆ [作者信息] Rakhitha Nimesh Ratnayake ...

    impress.js

    Impress.js 是国外一位开发者受 Prezi启发,采用 CSS3 与 JavaScript 语言完成的一个可供开发者使用的表现层框架。而 Prezi 是一个颠覆性的在线演示工具,此前我们也曾有过介绍,并得到很多读者的积极反馈。现在普通...

    impress.js高级特效展示 适用于个人介绍 超级酷炫

    impress.js高级特效展示 适用于个人介绍 超级酷炫,js支持键盘方向控制的引导页面模板

    前端项目-impress.js.zip

    前端项目-impress.js,它是一个基于CSS3在现代浏览器中的转换和转换能力的演示框架,灵感来自prezi.com背后的思想。

    使用impress.js制作幻灯片

    只需要简单的用一些html指令,并加载impress.js就可以制作出一个很绚丽的缩放式幻灯。 制作时首先你需要写一些head,这和普通的Web是一样的,但body不同。由于目前impress.js只支持Chrome、Firefox和Safari这样的...

    impress.js幻灯片sql分享

    直接在impress给定的官方demo上修改的一个简单介绍sql的ppt 增加了一些也没

    impress.js 神器

    impress.js 神器

    impress.js源码及Demo

    Impress.js是一款基于css3转 换和过渡、工作于现代浏览器(Google Chrome或Safari (或 Firefox...如果你已经厌烦了使用PowerPoint制作PPT,那么impress.js是一个非常 好的选择,用它做的PPT更加直观,效果也非常的不错。

    impress.js-master.zip

    JavaScript实现的演示功能,很炫的演示,只要在源码中添加进去自己的信息就可以用网页来演示了

    用impress.js做的关于bitcoin演示稿ppt动画效果下载

    用impress.js做的关于bitcoin演示稿ppt动画效果下载

    impress_demo:impress.js演示

    虽然是使用的impress.js,但是其中原来demo中使用的impress-demo.css已经有所改变,并且命名为了impress_default.css。 该代码只支持Chrome浏览器 因为写的时间比较仓促,所以有些代码是直接从别的地方拷贝过来的,而...

    impress.js CSS3 变换和过渡

    基于 CSS3 变换和过渡的页面效果框架 impress.js It's a presentation framework based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prezi.com.

    Impressionist, 创建 impress.js 演示文稿的可视化工具.zip

    Impressionist, 创建 impress.js 演示文稿的可视化工具 印象派印象派是创建 impress.js 演示文稿的可视化工具印象派是以创作共用属性 3.0 Unported ( CC按 3.0 ) ( http://creativecommons.org/licenses/by/3.0/ ) ...

    谈谈impress.js初步理解

     impress.js 采用 CSS3 与 JavaScript 语言完成的一个可供开发者使用的表现层框架(演示工具)。  现在普通开发者可以利用 impress.js 自己开发出类似效果的演示工具,但性能比基于 FLASH 的 Prezi 更优。其功能包括...

    Impress.js-presentation:Impress.js-演示文稿

    Impress.js-presentation:人工神经网络这是我使用 html5 中的 javascript 库 Impress.js 创建的研讨会演示文稿。 研讨会是关于人工神经网络的,由大约 20 张幻灯片组成。准备时间为 20-30 分钟。 可以按照给定的...

    impress.js表现层框架(演示工具)-初体验

    impress.js 是国外一位开发者受 Prezi 启发,采用 CSS3 与 JavaScript 语言完成的一个可供开发者使用的表现层框架(演示工具),现在普通开发者可以利用 impress.js 自己开发出类似效果的演示工具,但性能比基于 FLASH ...

    impressive-markdown:使用 Markdown 生成精美的 impress.js 演示文稿

    使用 markdown 生成精美的 impress.js 演示文稿。 这是一个使用示例: I love making fancy slides ~ Don't you just love images: ![Birdies](http://i.imgur.com/GgEGbsN.jpg) ~ Here are some bullets: 1. Build ...

    impress.js:基于CSS3转换和过渡的演示框架-开源

    以完全独特的方式可视化您的想法-使用impress.js的无限画布,唯一的限制就是您的想象力。 impress.js提供了许多出色的功能,以视觉上引人入胜的3D,动态运动以及各种文本选项和位置来展示您的想法。 它在Firefox和...

    impress.js:这是一个演示框架,基于现代浏览器中CSS3转换和转换的功能,并受到prezi.com背后思想的启发

    impress.js 这是一个展示框架,基于现代浏览器中CSS3转换和转换的功能,并受到prezi.com背后思想的启发。 警告 如果您无话可说,那么impress.js可能对您没有帮助;) 如何使用它 签出并初始化git仓库 git clone --...

Global site tag (gtag.js) - Google Analytics