QML歌词从左到右变色效果

编程入门 行业动态 更新时间:2024-10-10 05:26:09

QML歌词从左到右变色<a href=https://www.elefans.com/category/jswz/34/1770448.html style=效果"/>

QML歌词从左到右变色效果

要实现的效果如下:

代码:

import QtQuick 2.9
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0Window {visible: truewidth: 400height: 100title: qsTr("Hello World")Text{id: mtanchors.centerIn: parentvisible: falsecolor: "red"text:"曾经年少爱追梦,一心只想往前飞。"font.pixelSize: 24}PropertyAnimation{target: mr1property: "width"from: 0to: m2.widthduration: 5000loops: -1running: true}Rectangle{id: m2anchors.fill: mtcolor:"#00000000"Rectangle{id: mr1height:parent.heightcolor: "blue"//width是从0到m2.width}Rectangle{x: mr1.width  //从0到m2.widthheight:parent.heightwidth: m2.width-mr1.widthcolor: "red"}}ShaderEffectSource {id: maskvisible: falseanchors.fill: mthideSource : truesourceItem: m2}Blend {anchors.fill: mtsource: mtforegroundSource: maskmode: "color"}
}

参考:


更多推荐

QML歌词从左到右变色效果

本文发布于:2024-02-25 18:03:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1699843.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:效果   歌词   QML   左到右

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!