最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Nativescript rotate animation with infinite iteration not working - Stack Overflow

programmeradmin0浏览0评论

I want to rotate label with infinite iteration, currently it is working fine on iOS devices but on android it only rotates for 2 sec and then stop.

Below is my CSS code

.fas {
    font-family: "Font Awesome 5 Free", "fa-solid-900";
    font-weight: 900;
}

.spin {
    animation-name: rotate;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
<Label text="rotate value" class="fas spin"></Label>

I want to rotate label with infinite iteration, currently it is working fine on iOS devices but on android it only rotates for 2 sec and then stop.

Below is my CSS code

.fas {
    font-family: "Font Awesome 5 Free", "fa-solid-900";
    font-weight: 900;
}

.spin {
    animation-name: rotate;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
<Label text="rotate value" class="fas spin"></Label>

Share Improve this question edited Feb 12, 2020 at 0:21 vinita jain asked Jan 7, 2020 at 22:40 vinita jainvinita jain 1831 gold badge2 silver badges19 bronze badges 7
  • NativeScript doesn't support Java annotations, so you will have to write the WebInterface in Java library project and use it in your JS / TS code. Most of the functionalities in this case are already covered by nativescript-webview-ext plugin, you could try that. – Manoj Commented Jan 8, 2020 at 15:06
  • @Manoj I am new in Nativescript, I have added this plugin in project but enable to run any of the functionality. Is there any sample project which has implementation of this plugin. – vinita jain Commented Jan 8, 2020 at 21:10
  • Just refer the docs, I haven't used the plugin personally but I think you will call emit method on bridge from your webpage and listen to same in your code. – Manoj Commented Jan 8, 2020 at 22:17
  • It's exactly nsWebViewBridge.emit(eventName, dataToEmit) from your web page. – Manoj Commented Jan 9, 2020 at 3:05
  • @Manoj Thank You so much, Appreciate it. One question this bridge is used on both webpage and mobile app code to set a munication right? – vinita jain Commented Jan 9, 2020 at 16:30
 |  Show 2 more ments

1 Answer 1

Reset to default 17

I'm not sure if its a bug, can't expect {N} to be inline with Browsers as we are dealing with native elements here. The hack below seems to work,

@keyframes rotate {
    0% {transform: rotate(0deg);}
    99.9% {transform: rotate(360deg);}
    100% {transform: rotate(0deg);}
}
发布评论

评论列表(0)

  1. 暂无评论