How to create CSS keyframe rule in Dart

前端 未结 1 1390
挽巷
挽巷 2020-12-19 17:49

I need to create @keyframe rules dynamically in Dart and add them to document stylesheet. Here is an example in JS of what I\'m trying to do:



        
1条回答
  •  萌比男神i
    2020-12-19 18:19

    The following code seems to work.

    void main() {
      final styleSheet = document.styleSheets[0] as CssStyleSheet;
      final rule = '@-webkit-keyframes mymove { from {top:0px;} to {top:200px;} }';
      styleSheet.insertRule(rule, 0);
    }
    

    0 讨论(0)
提交回复
热议问题