Ich versuchte, eine Zunder ähnliche Funktion zu erstellen.Zunder wie Funktion, appcelerator
fand ich diesen Code:
var win = Titanium.UI.createWindow({
backgroundColor: "#ffffff",
title: "win"
});
// animations
var animateLeft = Ti.UI.createAnimation({
left: -520,
transform: Ti.UI.create2DMatrix({rotate: 60}),
opacity: 0,
duration: 300
});
var animateRight = Ti.UI.createAnimation({
left: 520,
transform: Ti.UI.create2DMatrix({rotate: -60}),
opacity: 0,
duration: 300
});
var curX = 0;
win.addEventListener('touchstart', function (e) {
curX = parseInt(e.x, 10);
});
win.addEventListener('touchmove', function (e) {
if (!e.source.id || e.source.id !== 'oferta') {
return;
}
// Subtracting current position to starting horizontal position
var coordinates = parseInt(e.x, 10) - curX;
// Defining coordinates as the final left position
var matrix = Ti.UI.create2DMatrix({rotate: -(coordinates/10)});
var animate = Ti.UI.createAnimation({
left: coordinates,
transform: matrix,
duration: 20
});
e.source.animate(animate);
e.source.left = coordinates;
});
win.addEventListener('touchend', function (e) {
if (!e.source.id || e.source.id !== 'oferta') {
return;
}
// No longer moving the window
if (e.source.left >= 75) {
e.source.animate(animateRight);
} else if (e.source.left <= -75) {
e.source.animate(animateLeft);
} else {
// Repositioning the window to the left
e.source.animate({
left: 0,
transform: Ti.UI.create2DMatrix({rotate: 0}),
duration: 300
});
}
});
for (var i = 0; i < 10; i++) {
var wrap = Ti.UI.createView({
"id": 'oferta',
"width": 320,
"height": 400,
"backgroundColor": (i % 2 == 0 ? "red" : "blue")
});
var text = Ti.UI.createLabel({
text: "row: " + i,
color: "black"
});
wrap.add(text);
win.add(wrap);
}
win.open();
Aber es ist eine seltsame Verhalten. In der Tat, wenn ich die Wrap-Ansicht von oben nahm, ist alles OK, aber wenn ich meinen Finger auf den Boden auf der Wrap-Ansicht, wird das Bild verrückt ..
Versuchen Sie den Code und Sie werden seltsames Verhalten sehen.
ich Titanium SDK 5.2.2 und iOS 9.3.1 auf einem iPhone 6.
Hier sa Video die seltsame Sache zeigt: http://tinypic.com/player.php?v=x37d5u%3E&s=9#.Vx_zDaOLQb0
(Sorry für die Videogröße) Vielen Dank für Ihre Hilfe
* "ein Zunder wie Funktion" * - Was bedeutet das? Du versuchst ein Feuer zu entfachen? – nnnnnn
Was bedeutet "verrückt"? –
würde es helfen, wenn Sie eine Videoaufnahme Ihres Bildschirms/Geräts teilen können – developer82