Javascript 为什么我的著名美国动画出人意料地前后移动?
我有一些基本的Famo.us代码,使用场景来定义场景图。我只是试着旋转这个著名的标志,但它不仅仅是旋转,它似乎也在前后移动,或者反复收缩和增长 下面是我的代码,但在它开始工作之前,您需要Famo.us v0.2.2,然后将其添加到著名的/core/Scene.js的第85行之后: 允许场景定义中对象文字的变换属性接受函数 这是我的代码,运行在一个著名的生成项目中,只修改了main.js中的Scene.js:Javascript 为什么我的著名美国动画出人意料地前后移动?,javascript,animation,famo.us,Javascript,Animation,Famo.us,我有一些基本的Famo.us代码,使用场景来定义场景图。我只是试着旋转这个著名的标志,但它不仅仅是旋转,它似乎也在前后移动,或者反复收缩和增长 下面是我的代码,但在它开始工作之前,您需要Famo.us v0.2.2,然后将其添加到著名的/core/Scene.js的第85行之后: 允许场景定义中对象文字的变换属性接受函数 这是我的代码,运行在一个著名的生成项目中,只修改了main.js中的Scene.js: /* globals define */ define(function(require
/* globals define */
define(function(require, exports, module) {
'use strict';
// import dependencies
var Engine = require('famous/core/Engine');
var Transform = require('famous/core/Transform');
var Scene = require('famous/core/Scene');
var Surface = require('famous/core/Surface');
// create the main context
var mainContext = Engine.createContext();
// your app here
mainContext.setPerspective(1200);
var initialTime = Date.now();
// define the main scene.
var mainScene = new Scene({
id: "root",
size: function() {
return [window.innerWidth, window.innerHeight];
},
target: [
{
id: 'background'
},
{
id: "logoSpin",
origin: [0.5, 0.5],
transform: function() {
return Transform.rotateY(.003 * (Date.now() - initialTime));
},
target: {
id: 'logoContainer',
size: function() {
return [window.innerWidth*0.8, window.innerHeight*0.8];
},
target: {id: "logo",},
},
},
],
});
var background = new Surface({
properties: { backgroundColor: '#25475E'},
});
var logo = new Surface({
properties: {
backgroundImage: 'url(/content/images/famous_logo.png)',
backgroundPosition: 'center center',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
},
//content: '/content/images/famous-logo.png',
classes: ['backfaceVisibility']
});
mainScene.id['logo'].add(logo);
mainContext.add(mainScene);
});
我基本上使用了默认的famo.us旋转徽标,并使用了一个曲面而不是ImageSurface,这样我就可以将图像作为背景图像应用,并使用backgroundSize:“contain”属性,以便能够始终在视图中包含徽标。
我正在旋转曲面,但我不明白为什么曲面在旋转时会前后移动
它为什么这样做?显然,我的代码没有问题。我已经更新了我的系统库,我使用的是Arch Linux,它现在可以正常工作,没有任何代码更改。代码保持完全相同。一定是Chromium渲染中的某个东西在更新中被更改/修复了,还是什么
/* globals define */
define(function(require, exports, module) {
'use strict';
// import dependencies
var Engine = require('famous/core/Engine');
var Transform = require('famous/core/Transform');
var Scene = require('famous/core/Scene');
var Surface = require('famous/core/Surface');
// create the main context
var mainContext = Engine.createContext();
// your app here
mainContext.setPerspective(1200);
var initialTime = Date.now();
// define the main scene.
var mainScene = new Scene({
id: "root",
size: function() {
return [window.innerWidth, window.innerHeight];
},
target: [
{
id: 'background'
},
{
id: "logoSpin",
origin: [0.5, 0.5],
transform: function() {
return Transform.rotateY(.003 * (Date.now() - initialTime));
},
target: {
id: 'logoContainer',
size: function() {
return [window.innerWidth*0.8, window.innerHeight*0.8];
},
target: {id: "logo",},
},
},
],
});
var background = new Surface({
properties: { backgroundColor: '#25475E'},
});
var logo = new Surface({
properties: {
backgroundImage: 'url(/content/images/famous_logo.png)',
backgroundPosition: 'center center',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
},
//content: '/content/images/famous-logo.png',
classes: ['backfaceVisibility']
});
mainScene.id['logo'].add(logo);
mainContext.add(mainScene);
});