HTML怎样把3d效果放大缩小,space-js: Space.js 是一个 HTML 驱动的 3D 滚动效果,是基于 Z 轴的滚动放大缩小 - 木兰确实...

Space.js

A HTML-driven JavaScript-library for narrative 3D-scrolling.

See the demos here

NOTE THAT SHOULD BE CONSIDERED TO BE BETA SOFTWARE

Production use is not recommended at this point.

Usage

Import the library

...

[Your contents]

The library is HTML-driven, which means that you don't need to write a single line of JavaScript to use it on your site and still have a lot of flexibility!

The core of the library is to divide our HTML into frames, or space-frames as we call them her (to not conflict the common class name "frame").

Creating a frame

[contents]

I would also strongly recommend using an inner-frame inside the space-frame, which provides some helpful CSS to make things centered both vertically and horizontally inside the frame.

[contents]

Custom duration

If we want we can provide a custom duration for our frames with the data-duration attribute, which multiplies the default duration of the transition.

...

...

Options

Space.js has a default default transition - which is to enter by fading in and exit by scaling up and fading out. We can also provide a custom transition override to the library from predefined transitions. (We can also create our own transitions from scratch, but we'll get to that later.)

...

Multiple values are supported!

...

Custom entry and exit

If we really want to get into detail, we can provide how we wish the frame to enter (first half of the frame duration) and exit (second half).

...

What a complete frame could look like

Demo 1

The Gallery

Custom transitions

You can add your own transitions with the ```addTransitions`` method. Make sure it is done after the library is loaded.

var transitions = {

rotate720: {

'rotate':{from:0, to:720}

},

fadeOutHalf: {

'opacity':{from:1, to:0.5}

}

};

Space.addTransitions(transitions);

Currently supported transitions

Note that these might come to change during the beta-phase of the library.

scaleIn

fadeIn

scaleOut

fadeOut

rotateQuarterRight

rotateInQuarterClockwise

zoomOut

slideInBottom

slideOutDown

slideOutLeft

slideOutRight

slideInRight

slideOutUp

slideInTop

slideInLeft

slideBottomRight

rotate360

rotate3dOut

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值