Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一个 3D 翻书效果 #8

Open
16slowly opened this issue Aug 29, 2018 · 0 comments
Open

一个 3D 翻书效果 #8

16slowly opened this issue Aug 29, 2018 · 0 comments
Assignees
Labels
Animation css 动画 JS 基础知识 面试

Comments

@16slowly
Copy link
Owner

16slowly commented Aug 29, 2018

借鉴自人人网 FED 的《怎么实现一个3d翻书效果》

主要整理 css3 的 animationtransform

最终效果

思路

Dom Stacking Context

参考:https://segmentfault.com/a/1190000014382426

Dom 操作

https://stackoverflow.com/questions/2943140/how-to-swap-html-elements-in-javascript

1. 获取节点:

// 改写 querySelector
let $ = document.querySelector.bind(document)

// 像使用 jquery $一样使用
$(seletor)

2. DocumentFragment

3. 属性处理:

  • removeAttribute(attr)
  • setAttribute(attr, value)

4. Dom Event

CSS animation

  • animation-name: 动画帧名
  • animation-duration: 动画执行时长
  • animation-timing-function: 动画速度曲线,支持 Bézier curve (贝塞尔曲线) cubic-bezier()
  • animation-delay: 延迟多久开始启动动画
  • animation-direction: normal(正常播放) | alternate(反向播放), 动画是否轮流反向播放。
  • animation-fill-mode: forwards(保留动画在最后一个属性值,最后一帧) | backwards(animation-delay 所规定的启动时的属性值将设置为第一帧的样式) | both(同时)
  • animation-iteration-count: n | infinite, 动画执行次数。

CSS transform

  • transform-style: preserve-3d
  • transform-origin: ·left ceter
  • transform: scale(x, y)
  • transform: translateZ()
  • transform: perspective()
  • transform: rotateY()

任务管理机制

@16slowly 16slowly self-assigned this Aug 29, 2018
@16slowly 16slowly added the Animation css 动画 label Oct 24, 2018
@16slowly 16slowly added the JS 基础知识 面试 label Dec 18, 2018
@16slowly 16slowly changed the title 一个 3d 翻书效果 一个 3D 翻书效果 Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Animation css 动画 JS 基础知识 面试
Projects
None yet
Development

No branches or pull requests

1 participant