transition

CSS transition property on page exit

▼魔方 西西 提交于 2020-01-04 09:23:05
问题 I need a few objects on my pages to animate out when a user clicks a link. I want each object to scale and fade out but not all objects such as the navigation buttons. I was thinking that upon a user clicking a link, the page delays 1 second before opening the redirecting the link to allow fade out giving the animation time to take effect. 回答1: Look at the JS event window.onbeforeunload https://developer.mozilla.org/en-US/docs/Web/API/window.onbeforeunload It will hopefully be enough to just

react过渡动画效果的实现,react-transition-group

筅森魡賤 提交于 2020-01-04 01:38:11
本文介绍react相关的过渡动画效果的实现 有点类似vue的transition组件,主要用于组件mount和unmount之前切换时应用动画效果 安装 cnpm install react-transition-group --save transition动画 import React from 'react' import ReactDOM from 'react-dom' import Transition from 'react-transition-group/Transition'; const duration = 300; const defaultStyle = { transition: `opacity ${duration}ms ease-in-out`, opacity: 0, width: "100px", height: "100px", background: "red" } const transitionStyles = { entering: { opacity: 0 }, entered: { opacity: 1 }, }; class MyComponent extends React.Component { constructor() { super(); this.state = { in: false } }

Vue深度学习(5)-过渡效果

拟墨画扇 提交于 2020-01-03 11:39:35
简介 通过 Vue.js 的过渡系统,你可以轻松的为 DOM 节点被插入/移除的过程添加过渡动画效果。Vue 将会在适当的时机添加/移除 CSS 类名来触发 CSS3 过渡/动画效果,你也可以提供相应的 JavaScript 钩子函数在过渡过程中执行自定义的 DOM 操作。   以 v-transition="my-transition 这个指令为例,当带有这个指令的 DOM 节点被插入或移除时,Vue 将会:   1.用 my-transition 这个 ID 去查找是否有注册过的 JavaScript 钩子对象。这个对象可以是由 Vue.transition(id, hooks) 全局注册,或是通过 transitions 选项定义在当前的组件内部。如果找到此对象,则会在过渡动画不同的阶段调用相应的钩子。   2.自动探测目标元素是否应用了 CSS 过渡效果或者动画效果,并在适当的时机添加/移除 CSS 类名。   3.如果没有提供 JavaScript 钩子函数,也没有检测到相应的 CSS 过渡/动画效果, DOM 的插入/移除会在下一帧立即执行。 <div v-if="show" transition="my-transition"></div> 所有的 Vue.js 过渡效果只有在该 DOM 操作是通过 Vue.js 触发时才会生效。触发的方式可以是通过内置指令,比如 v

一个简单的CSS3+js 实现3D BOX

醉酒当歌 提交于 2020-01-03 08:03:29
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style> html, body, div, span, h1, h2, h3, h4, h5, h6, p a, img, ol, ul, li { margin:0;padding:0;border:0;outline:0; } body { margin-top: 5em; text-align: center; color: #414142; background: rgb(246, 241, 232); background-image: -webkit-radial-gradient(farthest-side ellipse at center, rgba(246, 241, 232, .85) 39%, rgba(212, 204, 186, .5) 100%), url("../img/1.jpg"); background-image: -moz-radial-gradient(farthest-side ellipse at center, rgba(246, 241, 232, .85) 39%, rgba(212, 204, 186, .5) 100%), url("../img/1.jpg");

前端代码相关规范

萝らか妹 提交于 2020-01-03 01:33:32
总结一下目前在用的前端代码规范,可作为开发参考 一、基础规范 开发规范 项目目录和文件的命名使用小写字母,避免使用大写或驼峰,多个单词以下划线 _ 分隔 如:my_project/cast_detail.js 目录有复数意义的时候,使用复数命名 如 scripts images 某些第三方插件可直接使用中划线 - 作为文件名单词的间隔 如 bootstrap-datepicker 某些特殊文件可以使用点号 . 作为文件名单词的间隔 如 webpack.config.dev.js jquery.cookie.min.js 使用有意义的英文单词式命名,避免使用拼音式(如 tupian.png )命名 编辑器设置文件保存格式为 utf-8,以四个空格作为缩进(包括HTML,CSS,JS等),文件末尾空一行,行尾去掉空格 单个函数行数,以不超过一个屏幕为宜(50行左右),超出一个屏幕的,就要考虑拆分成更少的函数 每行代码量不要太长,要适当进行分行(自己也可以在编辑器设置超长自动换行) 在 sublime 中的配置 { "default_encoding": "UTF-8", "ensure_newline_at_eof_on_save": true, "trim_trailing_white_space_on_save": true, "tab_size": 4, "translate

Can d3's transition and rotation play well together?

给你一囗甜甜゛ 提交于 2020-01-02 09:59:32
问题 Transitions in combination with rotations have odd results. Here is a fiddle with my problem: http://jsfiddle.net/emperorz/E3G3z/1/ Try clicking on each square to see the varying behaviour. Please forgive the hacked code, but if I use transition with rotation (and x/y placement) then it loops about. I have tried: 1) all in the transform (rotate then translate), and that seems mostly okay. A little wobbly. 2) just rotate in the transform, positioned using x/y attributes. Flies all over the

Java Swing element transitions

£可爱£侵袭症+ 提交于 2020-01-02 02:54:09
问题 I am trying to make a small non-commercial app and make it have a well designed interface, with screen transitions and such. I have every "screen" on separate panels in one JFrame and wish to be able to slide them smoothly when transitioning between panels. Is there any way to accomplish this somewhat easily? 回答1: Since you did not accepted an answer yet, may I suggest you the SlidingLayout library? It's a very small library which aim is to create smooth transitions between two layouts of

[CALayer retain]: message sent to deallocated instance?

旧巷老猫 提交于 2020-01-01 14:26:00
问题 In my app when I am switching views, after about the 4th time I switch views I get a crash that says: *** -[CALayer retain]: message sent to deallocated instance 0x6c4ba0 I have NSZombieEnabled in Xcode and it points me to this line whenever it switches views: [self.view removeFromSuperview]; Also if I do a backtrace of the (gdb) it gives me this: #0 0x37dd68a0 in ___forwarding___ () #1 0x37d31680 in __forwarding_prep_0___ () #2 0x37d1d026 in CFRetain () #3 0x37d26bb2 in +[__NSArrayI __new::]

Android: activity transition/animation in ActivityGroup

隐身守侯 提交于 2020-01-01 04:01:07
问题 I use ActivityGroup to manage activities, I want to add animation when change activity, the code I used to change to next activity is: Intent intent = new Intent(getParent(), AnotherActivity.class); TabGroupActivity parentActivity = (TabGroupActivity) getParent(); parentActivity.startChildActivity("AnotherActivity", intent); And inside startChildActivity : Window window =getLocalActivityManager().startActivity(Id,intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); if (window != null) { View

优化checkbox和radio,类似Bootstrap中的iCheck

半世苍凉 提交于 2019-12-31 13:41:28
checkbox和radio浏览器默认的已经满足不了大众的审美需求,更不用说浏览器之间的差异化,取而代之,优化checkbox和radio的方法也随之诞生了。 html结构: 单选框为例,简单说明: 其中必需项包括:class="radio" 和 name="名称" <div class="radio" name="sex" value="boy"><ins></ins><span>帅哥</span></div> <div class="radio" name="sex" value="girl"><ins></ins><span>靓妹</span></div> <div class="radio" name="sex" value="unsex"><ins class="disabled"></ins><span>未选中不可点击</span></div> <div class="radio" name="sex" value="sexed"><ins class="enable"></ins><span>选中不可点击</span></div> css表现: transition介绍: 元素从一种样式逐渐改变为另一种的效果。 transition 简写属性,用于在一个属性中设置四个过渡属性。 transition-property 规定应用过渡的 CSS 属性的名称。