preact

Scene.js 库:CSS创建动画基于时间轴的动画

那年仲夏 提交于 2019-12-07 02:02:21
Scene.js 是一个基于 JavaScript 时间轴的动画库,用于创建动画网站,作为一个动画时间轴库,它允许你创建对象的移动和位置的时间顺序。 此外,由于 Scene.js 的语法类似于 CSS 动画,同时还支持 JavaScript 和 CSS 的播放方法,因此使用起来简单又方便。在本文中,我将详细介绍它的主要特点。 可同时控制多个元素 要知道,动画元素很难控制,因为动画的开始和结束时间并不同。 来源:https://github.com/daybrush/scenejs-timeline 而 Scene.js 可以同时控制多个动画元素,即使开始和结束时间都不同,也可以进行重播。 你可以通过同时开始和结束来重播一个场景。 Scene.js 还可以让你完全控制时间,这样你就可以准确地显示当前时间的移动情况。 通过转换 CSS 语法很容易使用 Scene.js 类似于 CSS 使用关键帧的方式,允许按原样使用 CSS 属性。因此,那些用过 CSS 动画的人可以很容易地使用 Scene.js。以下是 CSS 关键帧的代码。 .animate { animation-name: keyframes1; animation-duration: 4; animation-iteration-count: 3; animation-timing-function: ease-in-out

Wrong components rendered by Preact

流过昼夜 提交于 2019-11-30 01:20:24
I'm using Preact (for all intents and purposes, React) to render a list of items, saved in a state array. Each item has a remove button next to it. My problem is: when the button is clicked, the proper item is removed (I verified this several time), but the items are re-rendered with the last item missing, and the removed one still there. My code (simplified): import { h, Component } from 'preact'; import Package from './package'; export default class Packages extends Component { constructor(props) { super(props); let packages = [ 'a', 'b', 'c', 'd', 'e' ]; this.setState({packages: packages});

Wrong components rendered by Preact

有些话、适合烂在心里 提交于 2019-11-28 22:49:56
问题 I'm using Preact (for all intents and purposes, React) to render a list of items, saved in a state array. Each item has a remove button next to it. My problem is: when the button is clicked, the proper item is removed (I verified this several time), but the items are re-rendered with the last item missing, and the removed one still there. My code (simplified): import { h, Component } from 'preact'; import Package from './package'; export default class Packages extends Component { constructor