【问题标题】:How to skew View in appcelerator alloy (Titanium)如何在 appcelerator 合金(钛)中倾斜视图
【发布时间】:2016-05-06 19:20:49
【问题描述】:

我想要this 之类的东西,找不到任何在钛中使用倾斜的示例。

http://www.w3schools.com/cssref/playit.asp?filename=playcss_transform_skew

【问题讨论】:

    标签: mobile appcelerator transformation appcelerator-titanium skew


    【解决方案1】:

    由于 3DMatrix 的可用性,目前只能在 iOS 上使用。

    试试这个

    var ANIMATION = require('animation');
    
    var window = Ti.UI.createWindow({
        title : "Tilt Animations",
        backgroundColor : 'white'
    });
    
    var view = Ti.UI.createView({
        backgroundColor : '#0bb',
        width : '70%',
        height : '50%'
    });
    
    var label = Ti.UI.createLabel({
        text : 'My Div',
        color : 'black',
        touchEnabled : false
    });
    
    if (OS_IOS) {
        view.addEventListener('touchend', touchend);
        view.addEventListener('touchcancel', touchend);
        view.addEventListener('touchstart', touchStartMove);
        view.addEventListener('touchmove', touchStartMove);
    }
    
    view.add(label);
    window.add(view);
    window.open();
    
    function touchStartMove(e) {
        ANIMATION.touchStartOrMove(e, view);
    }
    
    function touchend(e) {
        ANIMATION.touchEnd(view);
    }
    
    • 找到animation.js here,放到Project->app->lib文件夹中
    • 现在尝试拖动光标或单击视图上的任意位置,当光标在视图上拖动时,您将看到各个方向的倾斜动画。
    • 因此,要完全复制您的问题,您只需提供选择选项并据此设置角度。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-30
    • 1970-01-01
    • 1970-01-01
    • 2012-07-18
    • 1970-01-01
    • 2020-10-29
    • 2017-08-04
    相关资源
    最近更新 更多