7
我試圖將此Popmotion
示例轉換爲GreenSock
。將Popmotion示例轉換爲GreenSock
http://codepen.io/popmotion/pen/ojrmmd
var SELECTOR = '.box';
var velocityRange = [-1000, 1000];
var maxRotate = 30;
var smoothing = 100;
var box = ui.select(SELECTOR, {
values: {
x: 0,
y: 0,
rotateY: {
watch: function (actor) {
return actor.values.x.velocity;
},
mapFrom: velocityRange,
mapTo: [-maxRotate, maxRotate],
smooth: smoothing
},
rotateX: {
watch: function (actor) {
return actor.values.y.velocity;
},
mapFrom: velocityRange,
mapTo: [maxRotate, -maxRotate],
smooth: smoothing
}
}
});
var track2D = new ui.Track({
values: {
x: {},
y: {}
}
});
var springBack = new ui.Simulate({
simulate: 'spring',
spring: 500,
friction: 0.3,
values: {
x: 0,
y: 0
}
});
$('body').on('touchstart mousedown', SELECTOR, function (e) {
e.preventDefault();
box.start(track2D, e);
});
$('body').on('touchend mouseup', function() {
box.start(springBack);
});
作爲一個總的小白在GreenSock
,這是很容易做到? GreenSock
有演員和模擬器嗎?
不知道如果你已經看到GSAP的** [可拖動](http://greensock.com/draggable)**插件時,沿側使用** [ThrowProps(https://開頭使用GreenSock的.com/throwpropsplugin)**。 –
@TahirAhmed對,這是一個非常好的開始,我也在尋找定向傾斜的東西。你知道怎麼做嗎? – Harry
CSS 3d轉換在GSAP中絕對可用,但要創建此類轉換的精確副本,需要開發人員進行一些工作。不難,但不是開箱即用的。不要認爲GSAP中預置了任何可以完全按照您希望的方式運行的東西。我會留下幾個鏈接:https://greensock.com/css3/,http://greensock.com/cube-dial-tutorial。另外,請查看GSAP論壇,有一些非常聰明的人,我相信他們肯定會幫助你:http://greensock.com/forums/forum/11-gsap/。 –